Hi,
I'm trying to write the event handlers for menu item clicks. I have
sub-classed Win32::GUI::Window to provide the main window for my
application.
This all works nicely, except that I've just added a menu to my main
window and I can't seem to figure out how to access any object data from
my _Click handlers. The program below reproduces this issue. What I
would like is to be able to access the main window as $self in sub
Exit_Click, but it's undefined.
#!/usr/bin/perl -w
package MyWindow;
use Win32::GUI();
@MyWindow::ISA = qw (Win32::GUI::Window);
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my %params = @_;
$params{-menu} = Win32::GUI::Menu->new(
"&File" => "File",
">E&xit" => "MyWindow::Exit",
);
my $self = $class->SUPER::new(%params);
bless $self, $class;
return $self;
};
sub Exit_Click {
my $self = shift;
print ref($self), "\n";
print "File->Exit Clicked";
return -1;
}
1;
package main;
my $window = new MyWindow(-height => 200, -width => 300);
$window->Show();
Win32::GUI::Dialog();
__END__
Is there any way to call the _Click event handlers as object methods
rather than class methods?
Cheers,
Gareth John
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Perl-Win32-GUI-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/