> -----Original Message----- > From: Aldo Calpini [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 28, 2002 8:18 AM > To: Frazier, Joe Jr; Perl-Win32-GUI-Users > Subject: Re: [perl-win32-gui-users] Win32::GUI Release 0.0.665 > > > 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.
I would probably do something simular to the way XML::SAX::* works and do this package My::Package; my $gui = My::Package->new() ..... .... sub myhandler{ } package main; my $Window = Win32::GUI::Window->new( # .... -events => { Terminate => $gui->myhandler(); Activate => sub { print "here I am!\n"; }, }, -onMinimize => sub { print "no please!\n"; }, ); Now, the question is, how does it work to pass in stuff such as the listview passing the row clicked? or do we have to handle all that ourselves? If this is covered in the docs(are the docs more fleshed out?), let me know and I will check there. > > 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 ;-) > <vote type="my opinion">Use old style by default. This avoids users having to change thier code until they are ready to totally update thier code.</vote> > 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"; }, > ); > ooooooooooo! me like. > 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, > ); > > Awesome! If this works, it will greatly help me with some dynamic fields I would like to be able to add. ie. Have a DB which builds your app controls for you. Not "easily" possible in the old model, but it seems very easy with this new model (assuming the change event thing works). Sorry to be a pain, but i am so excited to check this out and have a few questions on gotchas I have ran into in the past before migrating. Joe Frazier, Jr. Technical Support Engineer Peopleclick Service Support Tel: +1-800-841-2365 E-Mail: mailto:[EMAIL PROTECTED]