On Sun, Jun 30, 2013 at 4:02 PM, Art Heimsoth <artst...@artheimsoth.com>wrote:
> Thanks Mark, yes this is on XP. Am I creating another problem if
> I always use unguarded on my methods, whether they are events
> or others?
>
Art,
In general I advise to make all event handlers unguarded. If you make all
methods unguarded, you could create another problem, sometimes.
Really, the best thing to do is to analyze everything and only make a
method unguarded if needed. But, hey, I rarely do that. So the blanket
statement make all event handlers unguarded is not the best advice. It is
good enough advice for the general use of ooDialog though. If you had a
mission critical application, you might want to make sure that having all
event handlers unguarded is the right thing to do.
If you have variables, especially exposed variables, that need to be
accessed sequentially. Or in a strictly deterministic order, then a
guarded method is usually the best way to do it.
What I do is make all my event handlers unguarded and all other methods I
leave guarded. Except convenience methods that are called from event
handlers. Those I make unguarded. Then if something hangs, I try to
figure out why. ;-)
>
> I am having other problems in my main program that I suspect are
> due to the usage of unguarded or lack of. I have an input panel
> with several edit input fields where I am using LOSTFOCUS and also
> GOTFOCUS on some of them. I have unguarded on all of those event
> handlers, but if I cancel out of that input panel, I sometimes get entries
> into one or more of those event handlers - like the event is pending
>
Well, when you move to a new input panel, which I assume is a dialog, you
will get a lost focus in the old one, in an edit control if that control
had the focus.
> somewhere when I do the cancel and start a different menu process.
> I don't know how to cancel the events when the original input menu
> is cancelled, and some of them will put up more info on the screen
> when they fire.
>
One thing you could try is adding a flag. Set it to .true when you start
with the first input panel and set it to .false right before you cancel out
of it. In the event handler, if the flag is .false return immediately
without doing any thing.
--
Mark Miesfeld
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users