1. doEvents

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

new topic     » topic index » view message » categorize

2. Re: doEvents

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!
> 
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: doEvents

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

new topic     » goto parent     » topic index » view message » categorize

4. Re: doEvents

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

new topic     » goto parent     » topic index » view message » categorize

5. Re: doEvents

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

new topic     » goto parent     » topic index » view message » categorize

6. Re: doEvents

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu