Re: event origination

From: Dmitry Karasik <dmitry_at_karasik.eu.org>
Date: 14 Feb 2003 10:52:07 +0100
To: prima_at_prima.eu.org

        Hi Sean!

On 14 Feb 03 at 01:51, "Sean" (Sean Healy) wrote:

 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.

 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
Received on Fri 14 Feb 2003 - 10:52:10 CET

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