1. doEvents
- Posted by Allen Robnett <alrobnett at alumni.princeton.edu> Jan 01, 2004
- 441 views
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
2. Re: doEvents
- Posted by Evan Marshall <1evan at sbcglobal.net> Jan 01, 2004
- 441 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! > >
3. Re: doEvents
- Posted by Rolf =?iso-8859-1?Q?Schr=F6der?= <rolf at rschr.de> Jan 01, 2004
- 453 views
Evan Marshall wrote: > > 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 Is this really the truth? I thought, DoEvents() is necessary under Win3 (a non preemtive multitasking system, but not under Win32, witch is a preemptive multitasking system. Do I misunderstand here something? Rolf
4. Re: doEvents
- Posted by "Martin Stachon" <martin.stachon at tiscali.cz> Jan 01, 2004
- 452 views
Rolf Schr=F6der wrote : > Evan Marshall wrote: > > > > From the Win32lib docs under "Events": > > > > proc] > > doEvents (integer id) > > Gives control back to windows until there are no pending events to proc= ess. > > Category: Events > > Is this really the truth? I thought, DoEvents() is necessary under Win3 > (a non preemtive multitasking system, but not under Win32, witch is a > preemptive multitasking system. > Do I misunderstand here something? This has been discussed before. With Euphoria, we have only one thread, so if we are inside a routine, we cannot respond to Windows events. doEvents() is a trick, which process some events and calls event handlers. It is not ideal, though. The best solution would be to have at least two threads, one doing computing, and the other processing Windows events, those needing no additional processing would go back to Windows, and the ot= her would be queued up for calling Euphoria event handlers. Martin
5. Re: doEvents
- Posted by "Kat" <gertie at visionsix.com> Jan 01, 2004
- 433 views
On 1 Jan 2004, at 17:29, Rolf Schr=F6der wrote: >=20 >=20 > Evan Marshall wrote: > >=20 > > From the Win32lib docs under "Events": > >=20 > > proc] > > doEvents (integer id) > > Gives control back to windows until there are no pending events to proc= ess. > > Category: Events >=20 > Is this really the truth? I thought, DoEvents() is necessary under Win3 > (a non preemtive multitasking system, but not under Win32, witch is a > preemptive multitasking system. > Do I misunderstand here something?=20=20 This is why i asked that sleep(0) be a valid command also, because 0 does= =20 almost the same in regards to other programs running. Some of my apps=20 have hung the OS for minutes at a time without sleep(0) in some loops. All = it=20 does is hand the thread back to the task scheduler for it to process other= =20 apps doevents. It's a requirement in win3.x for a well behaved app. Kat
6. Re: doEvents
- Posted by "Kat" <gertie at visionsix.com> Jan 01, 2004
- 446 views
On 1 Jan 2004, at 17:47, Martin Stachon wrote: > > > Rolf Schr=F6der wrote : > > Evan Marshall wrote: > > > > > > From the Win32lib docs under "Events": > > > > > > proc] > > > doEvents (integer id) > > > Gives control back to windows until there are no pending events to proc= > ess. > > > Category: Events > > > > Is this really the truth? I thought, DoEvents() is necessary under Win3 > > (a non preemtive multitasking system, but not under Win32, witch is a > > preemptive multitasking system. > > Do I misunderstand here something? > > This has been discussed before. With Euphoria, we have only one thread, > so if we are inside a routine, we cannot respond to Windows events. > doEvents() is a trick, which process some events and calls event handlers. > It is not ideal, though. The best solution would be to have at least two > threads, one doing computing, and the other processing Windows events, > those needing no additional processing would go back to Windows, and the ot= > her > would be queued up for calling Euphoria event handlers. See Al Getz at: http://www.rapideuphoria.com/cgi-bin/displayserver205.zip Yes, i know that url is mangled, and the zip is not found, but that is how the RDS url http://www.rapideuphoria.com/cgi- bin/asearch.exu?dos=on&win=on&gen=on&keywords=windows+server gives it. Kat