# $Id: composite.pod 1.2 Wed, 12 Nov 1997 00:30:45 +0100 ach $ =head1 NAME Tk::composite - Defining a new composite widget class =for category Derived Widgets =head1 SYNOPSIS package Tk::MyNewWidget; use Tk::widgets qw/ list of Tk widgets /; use base qw/ Tk::Frame /; # or Tk::Toplevel Construct Tk::Widget 'MyNewWidget'; sub ClassInit { my( $class, $mw ) = @_; #... e.g., class bindings here ... $class->SUPER::ClassInit( $mw ); } sub Populate { my( $self, $args ) = @_; my $flag = delete $args->{-flag}; if( defined $flag ) { # handle -flag => xxx which can only be done at create # time the delete above ensures that new() does not try # and do $self->configure( -flag => xxx ); } $self->SUPER::Populate( $args ); $self = $self->Component( ... ); $self->Delegates( ... ); $self->ConfigSpecs( '-cursor' => [ SELF, 'cursor', 'Cursor', undef ], '-something' => [ METHOD, dbName, dbClass, default ], '-text' => [ $label, dbName, dbClass, default ], '-heading' => [ {-text => $head}, heading, Heading, 'My Heading' ], ); } sub something { my( $self, $value) = @_; if ( @_ > 1 ) { # set it } return # current value } 1; __END__ =head1 NAME Tk::Whatever - a whatever widget =head1 SYNOPSIS use Tk::Whatever; $widget = $parent->Whatever(...); =head1 DESCRIPTION ... =head1 DESCRIPTION The intention behind a composite is to create a higher-level widget, sometimes called a "super-widget" or "mega-widget". Most often, a composite will be built upon other widgets by B them, as opposed to specializing on them. For example, the supplied composite widget B is I an B and a B