Re: event origination

From: Sangqar (Sean Healy) <sangqar_at_hotmail.com>
Date: Sat, 15 Feb 2003 15:05:23 +0000
To: prima_at_prima.eu.org

> Sean> When responding to an event, is there any way to tell where it
> Sean> originated? That is, if a user clicked on a widget, can I find out
> Sean> what widget it was if I'm inside an event that was propagated to a
> Sean> different widget?
>
>No, not really. But there's a special method ( not event ) specifically
>made for onClose events - Widget::can_close(). It is called
>from Widget::close(), and sends onClose event to all children widgets.
>
>You can overload it in your master MDI window class and either simply do
>not
>call SUPER::can_close, so MDI clients never catch onClose, or set
>a flag that MDI clients can check out.

I tried overloading the on_close method to not call can_close, but on_close
was never called (at least, not while any MDI windows were visible). I
remember reading in the docs about a way to change the order in which events
are called, so maybe that's the way to go.

For now, since I was only showing one button in the MDI titlebar anyway, I
simply changed it to the minimize button and hide the MDI window in the
onWindowState event. That works, and onClose doesn't get cleared as before.

Sean

> Sean> The situation is this:
>
> Sean> I have a number of MDI widgets, which are only visible when the
>user
> Sean> asks for them. Since I don't want to have to recreate them every
> Sean> time, I simply hide them in the onClose event and then call
> Sean> clear_event. The trouble is, when I try to close the main window,
> Sean> it stays open, because the event is cleared when Prima tries to
> Sean> close the MDI widgets. Currently, I check whether the MDI window
>is
> Sean> visible; if it is, I hide it and call clear_event; if it's not, I
>do
> Sean> nothing. But this is less than perfect, because I have to click
>the
> Sean> close button on the main window once for each visible MDI widget,
> Sean> then once more to actually close it.
>
> Sean> Sean
>
>
> Sean> _________________________________________________________________
> Sean> Protect your PC - get McAfee.com VirusScan Online
> Sean> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
>
>
>--
>Sincerely,
> Dmitry
>
>--- www.karasik.eu.org ---
>
>Life ain't fair, but the root password helps.
> - BOFH

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
Received on Sat 15 Feb 2003 - 16:05:36 CET

This archive was generated by hypermail 2.2.0 : Sat 19 Mar 2011 - 18:35:04 CET