-
-
14 Feb 2021 12:53:44 UTC
- Distribution: Tk
- Module version: 4.011
- Source (raw)
- Pod Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (141)
- Testers (1416 / 13 / 0)
- Kwalitee
Bus factor: 2- % Coverage
- License: unrestricted
- Activity
24 month- Tools
- Download (6.7MB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- nick@ing-simmons.net (Nick Ing-Simmons)
- Dependencies
- Encode
- Test::More
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Tk::Derived - Base class for widgets derived from others
SYNOPSIS
package Tk::MyNewWidget; use Tk::widgets qw/ BaseWidget, list of Tk widgets /; use base qw/ Tk::Derived Tk::BaseWidget /; 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 }
DESCRIPTION
Tk::Derived is used with Perl's multiple inheritance to override some methods normally inherited from Tk::Widget.
Tk::Derived should precede any Tk widgets in the class's base class definition.
Tk::Derived's main purpose is to apply wrappers to
configure
andcget
methods of widgets to allow the derived widget to add to or modify behaviour of the configure options supported by the base widget.The derived class should normally override the
Populate
method provided by Tk::Derived and callConfigSpecs
to declare configure options.The public methods provided by Tk::Derived are as follows:
SEE ALSO
Module Install Instructions
To install Tk, copy and paste the appropriate command in to your terminal.
cpanm Tk
perl -MCPAN -e shell install Tk
For more information on module installation, please visit the detailed CPAN module installation guide.