[Lazarus] object casting to pointer

Marco Aurelio Ramirez Carrillo stardev.mramirez at gmail.com
Tue Nov 23 22:41:20 CET 2010


Hi.
I'm working witha TTreeview, and trying to assign a object to a
TTreeNode.data property:

<code>
MyTreeNode := myTreeview.add(nil, "MyTreeNode");

// any "TObject" descendant class
MyObject = MyClass.Create();

// all of these, generate a syntax/semantic error:

// no typecasting
MyTreeNode.Data := MyObject;
// typecasting lowercase
MyTreeNode.Data := pointer(MyObject);
// typecasting capital
MyTreeNode.Data := Pointer(MyObject);
// typecasting with address operator
MyTreeNode.Data := pointer(@MyObject);
</code>

But none of them seems to work.
I already search in the wiki. Any idea, what is missing ?

Thanks.

stardev tod maramirezc ta gmail tod com




More information about the Lazarus mailing list