What you're encountering is a fundamental and nontrivial problem. In REALbasic, a general solution is to represent a query using an object. This object can then notify other objects when a query is completed. This requires you to think about the problem you're trying to solve from an event-driven standpoint. Using a timer is usually a hack, although I have encountered an occasional situation in which a timer turned out to be the cleanest solution.

Charles Yeomans


On Jan 14, 2006, at 4:52 PM, johnf wrote:

Hi,

In my programs I want to wait for a function to complete before continuing on
with the rest of the program.  Most of this waiting has to do with data
access. So when I make a query I want the program to wait for the results of the query. Once I know the results I move to the next part of the program.

But nothing interupts the program flow.

make a data query.
if good data then -> this fires immediately does not wait until the query
completes

Adding a timer does not interrupt the flow. Timers only work when the program become idle or is out of the current function (not completely sure that is
correct).

make a data query.
timer1.enabled = true
if good data then -> this fires immediately does not wait until for the timer
to complete
Timer will now fire.......

make a data query.
timer1.mode = 2

timer1 action
'just wait until the data is good
if good data then
 dosomething
else
 dosomething_Else_to_correct_the_issue
end if
timer1.enabled = false

I think the last one is the correct way????  But it only sort of works.

So the question is how do I wait some action/query/function to complete before going on to the next part of the program. BTW with the last example a second timer will be required because the "dosomething_Else_to_correct_the_issue"
will also have to wait until it is finished - right?
John


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to