Parent of a SubClass ?

I had a bug in my code and found that my Custom SubClas Listbox returns Nil in the case below:

MyCustomLB.Parent.Child.Title = "My nice WIndow"

The code is based on:

LB.Parent.Child.Title = "My nice WIndow"

Where LB is a standard Listbox Control.

To be able to do that, I passed the window as parameter and all is clear.

Is it standard behavior ?

If I am following correctly what you want, I think all you need is:

self.Title = "My nice Window"

That should change the title of the window containing your subclassed listbox. Or else I am missing the point of what you are trying to do.

That seems so simple !

It depends on where my code was. I do not recall (I have to awake my brain a little bit and load the code !)

It may was in the Sub-Class ? Or elsewhere …
:wink:


I’m so tired… (The Beatles)

Parent is the control that contains the listbox, not the window. Eg., if you place the listbox on a canvas, the canvas is the Parent of the listbox. If the listbox is just on the window, Parent is Nil (there is no containing control).

That said, Parent.Child syntax is specific to FolderItems. I think you’re confusing things here.

Depending on what your code is for, you might want to use TrueWindow.Title this will allow you to place the control on a ContainerControl or deeply nested…

Four hours later, I am still in the dreams of the night.

Thank you All, I will get an eye there after a nap this afternoon.