I have created a window and put a listbox in it. I have that window called by a menu item from the main program window. Now is where I am lost.The window opens and is displayed on screen but I don’t know where to put the code to load the list box. I have tried to find it in the books but just can’t seem to find the solution.
You have to decide yourself. Controls should be responsible for themselves. So the listbox is responsible for getting it’s data.
Seriously: don’t worry so much. In all likelyhood your code won’t be seen by other eyes. So start with something. It will be very ugly but all of us have been at this stage. Your OO will improve with time. If you are planning for a smallish application OO or not OO doesn’t really matter.
Just to expand a little on what Beatrix and Tim said, put your code in the Listbox’s Open event by right-clicking on the ListBox, selecting “Add to ListBox”, then choose Event Handler. You will now get a list of all the events that the ListBox can receive and it’s useful to take a moment to peruse them. Scroll down to Open and click OK. You’ll now be in the Code Editor and if you look at the Navigator on the left, you’ll see that the code you’re about to write is for the Open event of the ListBox. Anything in here will run when the ListBox opens.
I have read all the books. But that is a ton of information to grasp all at once. About 500-600 pages. I’m still fumbling around in the IDE trying to learn what code needs to go where and when and how things operate within the IDE. Then add the newness of OOP and it’s a bit daunting. As far as I could tell there was no basic explanation of what info has to go where and when while using the IDE, unless I missed that. For example, 'When a control is added to a window you must put code in action section to cause it to work or whatever. Sounds simple but if not clear it’s a real pain tryiing to scour 600 pages of documentation trying to understand it all. Doing the best I can.
You may simply be trying to take too much at once. It seems you want instant results without taking the time to learn. Before OOP, start by the beginning.
Why don’t you simply try to follow step by step the QuickStartDesktop.pdf. Take your time, and don’t try to leap over a chapter until you are satisfied it actually works as described. You will discover the main concepts, IDE usage, as well as where to place code, and finally get the reward of a working application.
Pick a control you want to use like “listbox”. Look it up in the language reference and click on every event, property and method link. Read the details and look at the examples. You may only understand a portion of it at first but it will be retained as some level making it easier the next time through.
At least once a week you will see some veteran user here exclaim “Wow - I never knew that was built in”
There is an overwhelming amount of info to digest at once in any new language. I’m 15 years + into RB/Xojo and still learning every day.
Okay so I backed off and went to the desktop tutorial. Tis is as far as I got:
This is the code it said to put in “Add” button action space…
URLList.AddRow(TrackTextField.Text) … TrackTextField.Text is the name of the text field control. Workerd with "ShowUrl "
Here’s what shows on the bottom: This item doesn’t exist and then it has “URLList” highlighted in Yellow. I have looked through the documentation and can’t find URLList…I even googled it using Xojo Docs URLList. Nothing shows up.
Did you work through the examples presented, creating each one to learn? It really will help you with the questions you are asking here. Once fully digested you’ll understand quite a bit about Xojo and programming in general.
One significant change that happened with the new IDE is that previously, you were presented with all the possible event handlers and you filled in the ones you were interested in. This was somewhat self-documenting in that all the possibilities were visible. Now, with the new IDE, you only “see” the ones you are interested in. This has certain technical advantages as well as personal, but it can be a bit disconcerting to the uninitiated. Perhaps the main thing you need to know is how to add an event handler. The current method is to right-click the object, either in the layout editor or in the navigator, and select “Add To” and then “Event Handler”. That will present you with a list of all the available events. Choose the appropriate event and add you code there.