[Lazarus] How to cast a Interface to a Object in Lazaeus

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Fri Mar 13 18:12:58 CET 2015


On 2015-03-13 16:50, aradeonas wrote:
> Graeme I tested your way but you cant get property values with this way

See my slightly modified test.pas program from earlier. It seems that
using COM and 'as' is the preferred way when you want an object instance
from an interface reference. I never noticed the compiler Warning in my
previous test.pas program.

attached is a new test.pas and it clearly shows that you CAN call a
method and reference a property without problems.... as long as you use
COM interfaces.

Here is the new program output:

[tmp]$ ./test
via interface: My Caption
Pass: we got the object
Hello from the object
via object instance: My Caption



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pas
Type: text/x-pascal
Size: 1661 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150313/a5793f8e/attachment-0001.pas>


More information about the Lazarus mailing list