in reply to Which GUI libraries allow creation of megawidgets? (wxPerl?Gtk?)
#!/usr/bin/perl use Tk; use strict; package MyButton; # see perldoc Tk::mega use base qw/Tk::Derived Tk::Button/; Construct Tk::Widget 'MyButton'; sub ClassInit { my ($class, $mw) = @_; $class->SUPER::ClassInit($mw); # $mw->bind($class, '<Enter>', sub{print "Entered a MyButton\n"}); } sub Populate { my ($self, $args) = @_; $self->SUPER::Populate($args); $self->bind('<Enter>', sub{print "Entered a MyButton\n"}); # my (@bt) = $self->bindtags; # $self->bindtags( [ @bt[ 1, 0, 2, 3 ] ] ); } 1; package main; my $mw = MainWindow->new; $mw->Button(-text => 'NormalButton')->pack; $mw->MyButton(-text => 'MyButton')->pack; MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Which GUI libraries allow creation of megawidgets? (wxPerl?Gtk?)
by Courage (Parson) on Jan 07, 2005 at 14:57 UTC | |
by zentara (Cardinal) on Jan 08, 2005 at 11:54 UTC | |
by Courage (Parson) on Jan 08, 2005 at 12:43 UTC | |
by zentara (Cardinal) on Jan 08, 2005 at 12:52 UTC |