Re: event origination

From: Dmitry Karasik <dmitry_at_karasik.eu.org>
Date: 15 Feb 2003 22:47:09 +0100
To: prima_at_prima.eu.org

        Hi Sangqar!

On 15 Feb 03 at 16:05, "Sangqar" (Sangqar (Sean Healy)) wrote:

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

Overloading should work - and if it doesn't, it is indeed probably because
of call order. Let's see the source: Prima/Classes.pm declares Close event
as nt::Command, which ( perldoc Prima::Const ) is
nt::CustomFirst|nt::Event|nt::FluxReverse . In human language,
onClose callbacks are called before on_close, and as soon ::clear_event
is signalled, the calling loop stops. Example:

  package MyWidget; @ISA=qw(Prima::Widget);

  sub on_close { print 1 }

  MyWidget-> create( onClose => sub {
    print 2; $_[0]-> clear_event })-> close;

- 1 is never printed. To change Close event declaration one must
overload notification_types - which is probably not the best way
to go for your case.

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

Probably it is the best solution - in a way, the button bitmaps can be
reassigned more easily...

-- 
Sincerely,
	Dmitry
--- www.karasik.eu.org ---
Life ain't fair, but the root password helps.
                      - BOFH
Received on Sat 15 Feb 2003 - 22:47:12 CET

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