Re: doEvents
- Posted by Evan Marshall <1evan at sbcglobal.net> Jan 01, 2004
- 439 views
From the Win32lib docs under "Events": proc] doEvents (integer id) Gives control back to windows until there are no pending events to process. Category: Events id is usually zero, meaning that events for all controls are processed, however you can limit this to a particular control by supplying it id. Typically this is used inside user written event handlers when they know that they might take a long time to complete. For example, if by clicking a button the application must scan through all the files on a disk, it would be appropriate to include a doEvents() call inside the inner loop so that other windows events can be processed during the file search. If this isn't done, no control or window belonging to the application will respond until the disk scan is conpleted. For example, there might be another button that the user can click to abort the disk scan. Without doEvents() this would only respond after the disk scan is completed! Allen Robnett wrote: > > > I do not believe in prescience, but Hayden McKay comes close to shaking > my "non-faith". In response to my earlier request for help, he recently > replied: > > <snip> > Place this at the top of all 'while & for' loops > (after any delcared values) > > doEvents(0) > > This will keep everything active while loops are running. > This also prevents the app to "not responding" incase of a very long > loop. > <snip> > > I did not use this info because "guru" and "help" did not turn up any > references to it. Then, my system got hung in a problem which I have yet > to decipher, and I had to literally "pull the plug" to stop it. > > I still don't know anything about "doEvents", but I am convinced that I > need to learn. Is it an undocumented feature? > > Allen > > > > TOPICA - Start your own email discussion group. FREE! > >