Frazier, Joe Jr wrote:
> > $Window->AddButton(
> > -text => 'say hello',
> > -onClick => sub { print "hello, world!\n"; },
> > );
>
> Hmmm... is this the ONLY way or does the old method still work also?
the old method still works. but the main problem now is the interaction
between the methods. in a few words:
don't expect to use them both for the same window!
if you define a $Window with NEM events, *all* of the controls inside it
should have NEM events only, eg. no Button_Click won't work if the parent of
the Button has NEM events.
this is a little tricky, I know; in fact I proposed to add a pragma when
loading Win32::GUI, like this:
use Win32::GUI Event_Model => 'byref';
#### only NEM events in this script!
or
use Win32::GUI Event_Model => 'byname';
#### no NEM events in this script!
but I still don't know what to do when you just say use Win32::GUI ;-)
BTW, NEM events can also be specified inside a single -events option (or in
mixed style), as in:
my $Window = Win32::GUI::Window->new(
# ....
-events => {
Terminate => sub { -1 },
Activate => sub { print "here I am!\n"; },
},
-onMinimize => sub { print "no please!\n"; },
);
you can (err, should be able to, not really tested ;-) change events with
the Change() method. to cancel an event, undef it:
$Window->Change(
-onMinimize => undef,
);
cheers,
Aldo
__END__
$_=q,just perl,,s, , another ,,s,$, hacker,,print;