Parent of a SubClass ?

  1. 5 weeks ago

    Emile S

    Jul 16 Europe (France, Strasbourg)

    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 ?

  2. Douglas H

    Jul 16 Pre-Release Testers, Xojo Pro

    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.

  3. Emile S

    Jul 16 Europe (France, Strasbourg)

    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 …
    ;-)

    --
    I’m so tired… (The Beatles)

  4. Tim H

    Jul 17 Pre-Release Testers Portland, OR USA

    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.

  5. shao s

    is not verified Jul 17 Sudbury, Ontario, Canada

    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..

  6. Emile S

    Jul 17 Europe (France, Strasbourg)

    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.

or Sign Up to reply!