home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_6aa198ead7edf80182ebc2ff40b165e1
< prev
next >
Wrap
Text File
|
2000-03-23
|
4KB
|
126 lines
<HTML>
<HEAD>
<TITLE>Tk::Menu::Item - Base class for Menu items</TITLE>
<LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
<LINK REV="made" HREF="mailto:">
</HEAD>
<BODY>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> Tk::Menu::Item - Base class for Menu items</P></STRONG>
</TD></TR>
</TABLE>
<A NAME="__index__"></A>
<!-- INDEX BEGIN -->
<UL>
<LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
<LI><A HREF="#synopsis">SYNOPSIS</A></LI>
<LI><A HREF="#description">DESCRIPTION</A></LI>
<LI><A HREF="#bugs">BUGS</A></LI>
</UL>
<!-- INDEX END -->
<HR>
<P>
<H1><A NAME="name">NAME</A></H1>
<P>Tk::Menu::Item - Base class for Menu items</P>
<P>
<HR>
<H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
<UL>
<LI>Linux</LI>
<LI>Solaris</LI>
<LI>Windows</LI>
</UL>
<HR>
<H1><A NAME="synopsis">SYNOPSIS</A></H1>
<PRE>
require Tk::Menu::Item;</PRE>
<PRE>
my $but = $menu->Button(...);
$but->configure(...);
my $what = $but->cget();</PRE>
<PRE>
package Whatever;
require Tk::Menu::Item;
@ISA = qw(Tk::Menu::Item);</PRE>
<PRE>
sub PreInit
{
my ($class,$menu,$info) = @_;
$info->{'-xxxxx'} = ...
my $y = delete $info->{'-yyyy'};
}</PRE>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>Tk::Menu::Item is the base class from which Tk::Menu::Button,
Tk::Menu::Cascade, Tk::Menu::Radiobutton and Tk::Menu::Checkbutton are derived.
There is also a Tk::Menu::Separator.</P>
<P>Constructors are declared so that $menu-><CODE>Button(...)</CODE> etc. do what you would
expect.</P>
<P>The <CODE>-label</CODE> option is pre-processed allowing ~ to be prefixed to the character
to derive a <CODE>-underline</CODE> value. Thus</P>
<PRE>
$menu->Button(-label => 'Goto ~Home',...)</PRE>
<PRE>
is equivalent to</PRE>
<PRE>
$menu->Button(-label => 'Goto Home', -underline => 6, ...)</PRE>
<P>The <CODE>Cascade</CODE> menu item creates a sub-menu and accepts
these options:</P>
<DL>
<DT><STRONG><A NAME="item_%2Dmenuitems"><STRONG>-menuitems</STRONG></A></STRONG><BR>
<DD>
A list of items for the sub-menu.
Within this list (which is also accepted by Menu and Menubutton) the first
two elements of each item should be the ``constructor'' name and the label:
<PRE>
-menuitems => [
[Button => '~Quit', -command => [destroy => $mw]],
[Checkbutton => '~Oil', -variable => \$oil],
]</PRE>
<P></P>
<DT><STRONG><A NAME="item_%2Dpostcommand"><STRONG>-postcommand</STRONG></A></STRONG><BR>
<DD>
A callback to be invoked before posting the menu.
<P></P>
<DT><STRONG><A NAME="item_%2Dtearoff"><STRONG>-tearoff</STRONG></A></STRONG><BR>
<DD>
Specifies whether sub-menu can be torn-off or not.
<P></P>
<DT><STRONG><A NAME="item_%2Dmenuvar"><STRONG>-menuvar</STRONG></A></STRONG><BR>
<DD>
Scalar reference that will be set to the newly-created sub-menu.
<P></P></DL>
<P>The returned object is currently a blessed reference to an array of two items:
the containing Menu and the 'label'.
Methods <CODE>configure</CODE> and <CODE>cget</CODE> are mapped onto underlying <CODE>entryconfigure</CODE>
and <CODE>entrycget</CODE>.</P>
<P>The main purpose of the OO interface is to allow derived item classes to
be defined which pre-set the options used to create a more basic item.</P>
<P>
<HR>
<H1><A NAME="bugs">BUGS</A></H1>
<P>This OO interface is very new. Using the label as the ``key'' is a problem
for separaror items which don't have one. The alternative would be to
use an index into the menu but that is a problem if items are deleted
(or inserted other than at the end).</P>
<P>There should probably be a PostInit entry point too, or a more widget like
defered 'configure'.</P>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> Tk::Menu::Item - Base class for Menu items</P></STRONG>
</TD></TR>
</TABLE>
</BODY>
</HTML>