comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Widget program disappearing behind IDLDE
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Widget program disappearing behind IDLDE [message #41502] Tue, 02 November 2004 23:56
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Benjamin Hornberger writes:

> maybe somebody can explain this mysterious behaviour (Windows OS):
>
> I have a widget program A from which I can start another widget program
> B. When B pops up, it makes A insensitive (I have reasons not to use the
> /modal keyword). When I close B, it will make A sensitive again (in its
> cleanup procedure). B has two buttons to close it (ok, cancel), plus the
> Windows-standard "X" on the upper right.
>
> Now I have several programs open. If A is on top, and below is any
> program other than IDLDE, everything works fine. I pop up B, do my stuff
> there, and close it again (ok, cancel, or the "X"). A comes back and has
> the focus.
>
> If A is the active program, and below it is the IDLDE, the following
> happens: I pop up B, and when I close it again via the ok or cancel
> buttons, A disappears behind the IDLDE (which gets the focus). The user
> who doesn't know might think A was closed. If I close B via the "X" on
> the upper right, everything is fine, A will be on top and have the focus.
>
> If I add "widget_control, A, /show" after the "widget_control, A,
> /sensitive" in B's cleanup procedure, A will be on top after closing B
> via ok or cancel, but still IDLDE will have the focus (IDLDE's title bar
> is blue, A's title bar is grey).
>
> Does anybody know what's going on? I am adding some code below.

I'm not sure I can explain it, or even if this pathetic
attempt at explanation is even close to being accurate,
but I thought I would write just to let you know you aren't
going crazy. :-)

There is an odd behavior I have run into from time to time
with Windows event handling. Basically, the problem is that
things are not occuring in the order in which you *think*
they are occuring.

For example, when you close the window with the X, it is
clear you get into the B Cleanup routine and it does it's
job correctly. The next window "in the stack" as it were,
is A, from which B was called, so it is set properly.

Now, why doesn't that happen when you hit a button? What
happens when the button is selected? You go into the button
event handler and destroy the widget, right? And you would
expect that you would exit the event handler at that point,
and *then* the Cleanup routine would be called. But that is
not what happens. (It does happen this way on Unix machines,
I think.) In Windows, the Cleanup routine is called *before*
the event handler is exited. After the Cleanup is finished,
you jump back to the event handler (where, presumably, you
only have to exit). But I think the IDL interpreter has to
do the exiting, so momentarily it becomes the "current" window.
So when the B window *really* disappears the IDLDE is the
next window "in the stack".

I've complained about this in the past, but it has never
been fixed, I don't believe. I agree it is not the kind of
thing I normally lose sleep over, but it is aggrevating
occasionally. I don't think there is any way around it. :-(

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http:/www.dfanning.com/
Phone: 970-221-0438, IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Previous Topic: Re: Object cleanup when initialization fails
Next Topic: Storing variables in multiple widgets applications

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 00:38:46 PDT 2025

Total time taken to generate the page: 0.39883 seconds