Trying to understand Xojo

I am brand new as I have posted here before. I have gone through the books and still I am confused. Is there any basic tutorial or video that would explain the how’s and whys of using the Xojo interface. I understand how to drag and drop from the library and how to change some of the settings in the Inspector. But then when I need to add some code and where is confusing to me. I.m not a complete programming newbie, but OOP is brand new to me and I haven’t found a source that explains the nuts and bolts of how and when things need to connect in the interface.
I can add a button and then know that you need to do something with the action, but when to add an evenhandler and what code needs to go there is a mystery to me.

Any guidance would help.

Thanks,
Milfredo

Have a look at the webinars from Paul LeFevre (spelling?). These are available on the Xojo website linking to YouTube. Also, look at the many examples that come with Xojo.

I’m watching everything I can. I’ll keep looking. I would really like to use this language. Recently I tried to add to the menubar and could not figure out how to do it. So frustrating.

To get your head around a basic concept such as what happens when you trigger an event, try the ‘hello world’ example.
Cut and paste this into the action event of your button;

msgbox "hello Milford"

You can replace the text within the quotes with anything you like. Event handling is just another way of saying “when I do this, I want the program to do this. In the above example you are saying " when I click this button, I want a message box displayed with some kind of advice”.

The secret to Xojo is really in coming to grips with an event driven model. Once you get a feel for how events relate to your code (a button’s click is called the “Action” event, for example), you’ll start to understand the workflow. Xojo is a bit more strict that previous versions (Real Studio and REALbasic) where the object events were pre-populated for you, but all of the events are there, once you realize that you must add the one’s that you will be using.

A few feature requests that have been in the list for a while ask to add the most common default events to the control or object when you add them to your project. After all, what good is a PushButton without the Action Event? See feedback request feedback://showreport?report_id=29015 among others.

I suspect if these “normal” events were there for editing when you added your first controls, you’d have probably caught on mor quickly.

Thank you guys. I will keep fooling around with it, but if I don’t get it soon, I’ll have to go with Python.

If you take the time to patiently follow the documentation step by step, you should get there.

Will these videos help? There are much more.

Developing a Text Editor, part 1

Developing a Text Editor, part 2

Creating a Desktop Application using Xojo

If you go with Python, you ship your source codes with your products.

The Desktop Quickstart (part of what used to be the User’s Guide) is about as quick and dirty as you can get. - http://41160df63757fc043cfd-66287f38a83954e31a54d1dbe33e0650.r4.cf2.rackcdn.com/Documentation/EN-PDF/QuickStartDesktop.pdf

That being said, the fact that new users struggle to get the “flow” going show some of the non-intuitiveness of the IDE. To the everyday or long time users it feels right, but to a new user it can feel daunting (especially having to dig up actions and events they may not even know exist).

[quote=188545:@milford walton]I am brand new as I have posted here before. I have gone through the books and still I am confused. Is there any basic tutorial or video that would explain the how’s and whys of using the Xojo interface. I understand how to drag and drop from the library and how to change some of the settings in the Inspector. But then when I need to add some code and where is confusing to me. I.m not a complete programming newbie, but OOP is brand new to me and I haven’t found a source that explains the nuts and bolts of how and when things need to connect in the interface.
I can add a button and then know that you need to do something with the action, but when to add an evenhandler and what code needs to go there is a mystery to me.

Any guidance would help.

Thanks,
Milfredo[/quote]

Firstly, welcome to Xojo Milford.

If you want to learn some basics of OOP programming, while learning some fun graphics programming techniques with OpenGL at the same time, you can have a loot at the tutorials on www.xojo3d.com.

I would recommend you start with tutorial 1 and work your way up. Realizing that you might not necessarily be looking for advanced graphics programming tutorials, these tutorials do however contain a lot of OOP principles that you will be able to apply to any project you build in Xojo.

I trust you have read this? Introduction to Programming with Xojo It seems to be often missed by new users.

Yes Peter I have. But left a lot out for me. I’m a bit of a plodder I suppose. But for example, this stumps me…in the IDE you click the Insert button to insert a window. Say I do that. Now I add a button to it to open another window. What code do I put in the button action that will open another window? Can’t just type hit insert button…I know that sounds stupid but it’s things like that I am struggling with presently.

Thanks everyone for the help and suggestions. I really appreciate it.

Milfredo

Take a look in the docs at “Window” here: http://docs.xojo.com/index.php/Window
Windows have a .Show method that you use to show windows. http://docs.xojo.com/index.php/Window.Show

In the Action event of a Button to show another window would be:

Window2.Show

A good idea is to take a look at ImplicitInstance for Windows too for future reference :wink:
http://docs.xojo.com/index.php/Window.ImplicitInstance

I remember exactly it’s a difficult, if not to say hard time trying to get a grasp on OOP if you had not encountered it before. Try to see it this way: Everything’s (at least as good as*) objects! You create a project: You have an app object. There’s a window in it: This is another object in your app object. You drag a control on a window: You place an object on it.

You want to open a window from a button? A window is another object, so you need to have one. For creating objects, there’s the DIM and NEW commands, so in the action event of the button you do something like

Dim myNewWindow As New myWindowClass

Dim reserves the memory for the object, New initializes it.
Every object stems from a class, therefore you must have a myWindowClass as another window layout in your project.
Now that you created an object, you can use it:

myNewWindow.show

And when you do so, the appropriate events of myNewWindow will fire. You could do your own custom initialization in its open event and thus be sure it is executed when it’s needed.

Once you got this idea: Almost everything is an object*, and every object comes from a matrix – it’s class –, things start to fall into place.

  • One exception being datatypes like Integer which you don’t have to initialize via New but only use Dim to allocate their memory.

I once started with Realbasic by simply running the example projects. Then I started to modify them and to experiment with it, just to grasp the concepts.

Then I had an idea for my own software-project and started to put bits and pieces together. One learns programming with new tools by … programming.

And then of course: RTFM! Forward and backward.
http://en.wikipedia.org/wiki/RTFM

Read everything:
http://docs.xojo.com/index.php/Main_Page

Be aware that TKInter UI design in Python uses the same event driven model as Xojo - and the result pretty much suck for look and feel. And don’e get me started in wxPython and some of the others…

I’ve been a Pythoner since 1.2.0 and many of our (TOLIS Group’s) backend tools are written in Python 2, but without the TKInter layer. I wrap the back end python tools in Xojo GUI front ends and the resulting app on Linux, Windows and OS X look and feel like a native app.

From one old world top down, procedural programmer to another, I believe that a little patience and a bit of stick-tuitiveness (that’s a Southern term) will get you where you need to be with Xojo.

Thank you guys so much. I really can’t thank you enough. Luckily I have more time than money so will be sticking with it till I get things accomplished.

Thanks again,
Milfredo

[quote=188694:@Tim Jones]
From one old world top down, procedural programmer to another, I believe that a little patience and a bit of stick-tuitiveness (that’s a Southern term) will get you where you need to be with Xojo.[/quote]

Ditto
Used to write PL/1, Adabas/Natural, some Cobol, Fortran and a whole lot of other non-UI procedural code
Once you get it it just clicks
Stick with it

This is a small victory, but I have created my first page with necessary Menu Items and a picture attached to the window as a background. Yea!

Nothing happens with the menu items yet. Next job is to figure out how to open .csv files, read them and store the data for calculations to be done later in process.

Milfredo

For that, make a search in this forum and you will get tips (and even an example or two).