At 01:35 2005-03-25, Gareth John wrote:
Is there any way to automatically pass all Events (e.g. _Click events,
etc) through to the GUI object from the main perl script, or do I need to
forget about implementing the GUI as a class/object and do it all in the
main perl script?
That sounds a lot like how I thought when I started with Win32::GUI. But
the programming model for Win32::GUI doesn't work quite like that.
Event handlers are either subs that follow the naming convention (i.e
controlName_EventName), or if you are using the New Event Model (NEM) they
are coderefs.
Note that you can fake method calls with closures, something like this:
my $self = MyGUI->new();
my $win = ... create window...
$win->AddButton (
-name => "Test",
-text => "Test",
-events => {
Click => sub {
#$self and $win are available here
...
},
},
);
It's not entirely pretty, but it may work for you.
/J
-------- ------ ---- --- -- -- -- - - - - -
Johan Lindström Sourcerer @ Boss Casinos johanl AT DarSerMan.com
Latest bookmark: "TCP Connection Passing"
http://tcpcp.sourceforge.net/
dmoz: /Computers/Programming/Languages/JavaScript/ 12