Where to put the code?

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.

Thanks,
Milfredo

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.

HTH

Start by putting the code to load the listbox into the listbox’s Open event. If that proves to be insufficient, then look for another option.

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.

Did you read the pdf: QuickStartDesktop.pdf ?

Did you find the documentation Main Page ?

Have you get an eye in some of the provided examples, found in the… Examples folder (Applications - Xojo) ?

Yes, when one start an application (an OS), it is very frustrating to not understand things. But BASIC readings sometimes is… fantastic !

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.

Xojo provided a lot of example from basic to advance
Choose one and analyse how it works.
Even if Xojo is the easiest programming language… you have to make a minimum effort.

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.

Thanks for input. Patience isn’t one of my virtues, so I can get ahead of myself sometimes…LOL

Thanks again,
Milfredo

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.

Sorry for being so dumb.

is URLList the name of your ListBox?
if not, replace URLList with the name of your ListBox.

URLList is the listbox you added on page 10 and renamed to “URLList” on page 15. Perhaps you missed that last step.

I must have. I know I’m driving you guys a little crazy. But I really am thankful for you guys and your help.

Milfredo

No worries. Better to ask than be frustrated.

I’d suggest grabbing the book
Introduction to programming with Xojo
It walks you through a bunch of this

I read it Norman. It and the other 4. It’s just there is a ton of info to grasp. I am starting to get it though I believe.

Milford:

nearly all answers since my last one are 100% OK.

When the programmer is a beginner, (s)he ask all your questions.

When you start something, your expectations is to understand not spending days and days until you start understanding what you are doing.

At last, and after sometimes (even years) you can say: “this is news for me !”. I use REALbasic (now known as Xojo today) since version 1 (back in mid-1998) and this happens to me here and then.

At last, all advices given here are correct, even the one that said to be patient (unfortunately).

And, real all sentences, not one, skip the second, read the third and so one (that is something I am good at, sometimes).

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.