Quote:
Originally Posted by pmu5757
How can I do in the loop to wait for the ok click without blocking completely the program ?
|
This is a very common misconception that people have who are new to event driven programming. Unlike a "traditional" program event driven programs don't need to wait in loops for something to happen, the Operating System takes care of this for you. You just need to write subroutines (event procedures) that are invoked when something (an event) happens. Your code deals with that, the subroutine exits and the Operating System will call your code when the next event happens. The most common events are probably caused by user input but a timer expiring or external data data arriving can also be the source of events.
Your code should never loop unnecessarily as it eats up processor time that another app might be able to use, and on portable devices it wastes power and shortens battery life.