HI, I’m pretty new to this.
How would I go about getting the ubound of a listbox that’s in another window? I get the error that the listbox doesn’t exist so I must be referencing it wrong.
Also, is there some post or article that explains the object hierarchy in Xojo a bit more than the manual?
I’ve got a bit of programming and scripting background but because I’m new to object oriented programming I’m having some issues taking advantage of it properly.
Ubound of a ListBox? Perhaps you mean the ListCount?
To access something on another Window, you’ll need a reference to the window.
By default, you can do something like Window2.ListBox1.ListCount to get the number of rows in ListBox1 that is on Window2.
Have you also checked out the Introduction to Programming with Xojo book? Available here:
First off, just don’t do that. It’s bad design to have one window looking at and manipulating the innards of another window. Do it a few hundred times over in an app, and you have complete spaghetti reference code. From very recent experience with someone else’s code, I can tell you that when such code trips over problems in the Xojo framework like any GUI framework, there are and will always be many problems it is very expensive to isolate the problems and work around or fix them.
Instead, think about what services and public information your window should provide to others. Make computed properties and methods to provide this information and implement these services.
Yes, I’d gone through the Intro book, but good idea to go through again, it’s been about 4 months and I’ve forgotten a lot.