in reply to Which GUI libraries allow creation of megawidgets? (wxPerl?Gtk?)

Tk makes it easy to make a mega widget. Read perldoc Tk::mega. It basically means taking an existing widget or widgets, and combining them into a "customized widget". Here is a simple example. It takes a button and adds "mouse enter notification" to a Button. (Mastering Perl/Tk in Chapter 14 discusses custom widgets).
#!/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;

I'm not really a human, but I play one on earth. flash japh
  • Comment on Re: Which GUI libraries allow creation of megawidgets? (wxPerl?Gtk?)
  • Download Code

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
    I have no single doubt it is possible with perlTk, as my very first sentence states

    I was intended to gather information about whether it is possible everywhere else, and probably in which extent a user able to do this everywhere else.

    Thanks for your example, anyway.

      Damn! Got bit on the *ss again, by my speed reading. I could swear I didn't see that first sentence when I read it. :-)

      I'm not really a human, but I play one on earth. flash japh
        please don't be sad about it, the reason probably is my non-native English.
        please excuse me.
        We're in international community, you know :):):)
        I think you should not drop your fast-reading in general, but probably slower reading of some information-dense content (perl code is dense, short and priceless:) should help...

        I notice somehow my English becomes worse when I more tired...