Program flow control

OK, I am a beginner so don’t blame If I am asking something very simple.

Let’s say I have a Main window with 2 buttons.

These two buttons (when clicked) start to open up some new windows, load up DB data, fill up forms, populate menus, call methods, do some processing, etc.

Now… If when filling up the forms, populating the menus, etc a certain condition occurs… I would like the app to go back to the Idle state where it was when it was just opened. That is, close all windows, stop all processes, and return to the main window with two buttons waiting for the user to click.

I know I am not giving much info, but I think it’s not necessary, as what I want to know is if I am looking at this with the right approach.
Anyone can give me advices ?

thnks
R

This really depends on how you save your data. You could save a copy of your data before you start processing and then load this copy and the user is supposed to start from scratch. I think that this is the easiest method.

Well, the condition may arise when processing a query to an SQLite DB (and the display of the data)… my question is… how do I interrupt the execution of *everything", close all windows, etc, and go back to main -> idle state ?

You have to track this. Somehow. There is no easy way to do this.

I think you may need to step back and reorganize your thoughts… from what I am reading here, your mind set is stuck in a “procedural workflow”… that is not what environments like XOJO do (they can… but its not the best way to use them). This is as Object Oriented, Event Driven process. Meaning the program flow can and will take a right turn whenever a programmed event occurs (key press, mouse click, just to name a very few). So in this case your “condition” would define the event.

I knew it wasn’t the best approach… it’s just… I don’t know what to do when that happens… I feel like I am avoiding the problem and I just want the state of the app to “revert” to a good stable working condition…

As a beginning, you might find it useful to try our video training at http://xojo.bkeeney.com/XojoTraining/. Over 200 videos (most with source code) and over 65 hours of me showing you how I code projects. This includes 2 start to finish desktop applications (1 using a database) and 1 start-to-finish web application.

So far we’ve served up over 10,000 hours of video to people all over the world. It might not be your cup of tea but I thought I’d throw it out there.

thanks Bob, I’ll take a look at it!