>$keep_running. So wouldn't it be easier just to use Dialog and have
>that event return -1?
In most cases, yes. I would guess that Dialog() is a tighter and more
efficient loop than you can roll on your own in Perl.
What Dialog and DoEvents actually do is this: they process GUI messages
that makes the window respond to things the user does, like moving focus,
animating buttons as you click them, etc. If you use neither of these subs,
the window will be visible but totally "dead".
When the Dialog message loop triggers an event, e.g. btnUploadFile_Click,
the control moves from this GUI message processing into your event handler.
From now on, your code is executing, not the code keeping the GUI
responsive to the user.
So what if you have to do a _lot_ of stuff before you can return from the
event handler? In this case, your code is executing for a long time, the
GUI message code isn't executing at all; the GUI is "dead".
This is where you call DoEvents() to give the GUI a chance to handle
messages and respond to user interaction every once in a while. Do this "as
often as possible" to give the impression that the GUI is always listening
to user interaction.
BTW, most of this has been said before a few times. Browse the archives for
------ ---- --- -- -- -- - - - - -
Johan Lindström Boss Casinos
If the only tool you have is a hammer,
everything tends to look
like a nail