home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>Tk::Menubutton - Create and manipulate Menubutton widgets</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::Menubutton - Create and manipulate Menubutton widgets</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="#standard options">STANDARD OPTIONS</A></LI>
- <LI><A HREF="#widgetspecific options">WIDGET-SPECIFIC OPTIONS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#widget methods">WIDGET METHODS</A></LI>
- <LI><A HREF="#default bindings">DEFAULT BINDINGS</A></LI>
- <LI><A HREF="#keywords">KEYWORDS</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>Tk::Menubutton - Create and manipulate Menubutton widgets</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>
- <P><EM>$menubutton</EM> = <EM>$parent</EM>-><STRONG>Menubutton</STRONG>(?<EM>options</EM>?);</P>
- <P>
- <HR>
- <H1><A NAME="standard options">STANDARD OPTIONS</A></H1>
- <P><TABLE CELLSPACING=0 CELLPADDING=0><TR><TD><STRONG>-activebackground</STRONG><TD><STRONG>-cursor</STRONG><TD><STRONG>-highlightthickness</STRONG><TD><STRONG>-takefocus</STRONG>
- <TR><TD><STRONG>-activeforeground</STRONG><TD><STRONG>-disabledforeground</STRONG><TD><STRONG>-image</STRONG><TD><STRONG>-text</STRONG>
- <TR><TD><STRONG>-anchor</STRONG><TD><STRONG>-font</STRONG><TD><STRONG>-justify</STRONG><TD><STRONG>-textvariable</STRONG>
- <TR><TD><STRONG>-background</STRONG><TD><STRONG>-foreground</STRONG><TD><STRONG>-padx</STRONG><TD><STRONG>-underline</STRONG>
- <TR><TD><STRONG>-bitmap</STRONG><TD><STRONG>-highlightbackground</STRONG><TD><STRONG>-pady</STRONG><TD><STRONG>-wraplength</STRONG>
- <TR><TD><STRONG>-borderwidth</STRONG><TD><STRONG>-highlightcolor</STRONG><TD><STRONG>-relief</STRONG></TABLE></P>
- <P>See <A HREF="../../../site/lib/Tk/options.html">the Tk::options manpage</A> for details of the standard options.</P>
- <P>
- <HR>
- <H1><A NAME="widgetspecific options">WIDGET-SPECIFIC OPTIONS</A></H1>
- <DL>
- <DT><STRONG><A NAME="item_Name%3A_direction">Name: <STRONG>direction</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Height">Class: <STRONG>Height</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Ddirection">Switch: <STRONG>-direction</STRONG></A></STRONG><BR>
- <DD>
- Specifies where the menu is going to be popup up. <STRONG>above</STRONG> tries to
- pop the menu above the menubutton. <STRONG>below</STRONG> tries to pop the menu
- below the menubutton. <STRONG>left</STRONG> tries to pop the menu to the left of
- the menubutton. <STRONG>right</STRONG> tries to pop the menu to the right of the
- menu button. <STRONG>flush</STRONG> pops the menu directly over the menubutton.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_height">Name: <STRONG>height</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG>Class: <STRONG>Height</STRONG></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dheight">Switch: <STRONG>-height</STRONG></A></STRONG><BR>
- <DD>
- Specifies a desired height for the menubutton.
- If an image or bitmap is being displayed in the menubutton then the value is in
- screen units (i.e. any of the forms acceptable to <STRONG>Tk_GetPixels</STRONG>);
- for text it is in lines of text.
- If this option isn't specified, the menubutton's desired height is computed
- from the size of the image or bitmap or text being displayed in it.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_indicatorOn">Name: <STRONG>indicatorOn</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_IndicatorOn">Class: <STRONG>IndicatorOn</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dindicatoron">Switch: <STRONG>-indicatoron</STRONG></A></STRONG><BR>
- <DD>
- The value must be a proper boolean value. If it is true then
- a small indicator rectangle will be displayed on the right side
- of the menubutton and the default menu bindings will treat this
- as an option menubutton. If false then no indicator will be
- displayed.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_menu">Name: <STRONG>menu</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_MenuName">Class: <STRONG>MenuName</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dmenu">Switch: <STRONG>-menu</STRONG></A></STRONG><BR>
- <DD>
- Specifies the path name of the menu associated with this menubutton.
- The menu must be a child of the menubutton.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_state">Name: <STRONG>state</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_State">Class: <STRONG>State</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dstate">Switch: <STRONG>-state</STRONG></A></STRONG><BR>
- <DD>
- Specifies one of three states for the menubutton: <STRONG>normal</STRONG>, <STRONG>active</STRONG>,
- or <STRONG>disabled</STRONG>. In normal state the menubutton is displayed using the
- <STRONG>foreground</STRONG> and <STRONG>background</STRONG> options. The active state is
- typically used when the pointer is over the menubutton. In active state
- the menubutton is displayed using the <STRONG>activeForeground</STRONG> and
- <STRONG>activeBackground</STRONG> options. Disabled state means that the menubutton
- should be insensitive: the default bindings will refuse to activate
- the widget and will ignore mouse button presses.
- In this state the <STRONG>disabledForeground</STRONG> and
- <STRONG>background</STRONG> options determine how the button is displayed.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_width">Name: <STRONG>width</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Width">Class: <STRONG>Width</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dwidth">Switch: <STRONG>-width</STRONG></A></STRONG><BR>
- <DD>
- Specifies a desired width for the menubutton.
- If an image or bitmap is being displayed in the menubutton then the value is in
- screen units (i.e. any of the forms acceptable to <STRONG>Tk_GetPixels</STRONG>);
- for text it is in characters.
- If this option isn't specified, the menubutton's desired width is computed
- from the size of the image or bitmap or text being displayed in it.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>The <STRONG>Menubutton</STRONG> method creates a new window (given by the
- $widget argument) and makes it into a menubutton widget.
- Additional
- options, described above, may be specified on the command line
- or in the option database
- to configure aspects of the menubutton such as its colors, font,
- text, and initial relief. The <STRONG>menubutton</STRONG> command returns its
- $widget argument. At the time this command is invoked,
- there must not exist a window named $widget, but
- $widget's parent must exist.</P>
- <P>A menubutton is a widget that displays a textual string, bitmap, or image
- and is associated with a menu widget.
- If text is displayed, it must all be in a single font, but it
- can occupy multiple lines on the screen (if it contains newlines
- or if wrapping occurs because of the <STRONG>wrapLength</STRONG> option) and
- one of the characters may optionally be underlined using the
- <STRONG>underline</STRONG> option. In normal usage, pressing
- mouse button 1 over the menubutton causes the associated menu to
- be posted just underneath the menubutton. If the mouse is moved over
- the menu before releasing the mouse button, the button release
- causes the underlying menu entry to be invoked. When the button
- is released, the menu is unposted.</P>
- <P>Menubuttons are typically organized into groups called menu bars
- that allow scanning:
- if the mouse button is pressed over one menubutton (causing it
- to post its menu) and the mouse is moved over another menubutton
- in the same menu bar without releasing the mouse button, then the
- menu of the first menubutton is unposted and the menu of the
- new menubutton is posted instead.</P>
- <P>There are several interactions between menubuttons and menus; see
- the <STRONG>menu</STRONG> manual entry for information on various menu configurations,
- such as pulldown menus and option menus.</P>
- <P>
- <HR>
- <H1><A NAME="widget methods">WIDGET METHODS</A></H1>
- <P>The <STRONG>Menubutton</STRONG> method creates a widget object.
- This object supports the <STRONG>configure</STRONG> and <STRONG>cget</STRONG> methods
- described in <A HREF="../../../site/lib/Tk/options.html">the Tk::options manpage</A> which can be used to enquire and
- modify the options described above.
- The <STRONG>menu</STRONG> method returns the menu associated with the widget.
- The widget also inherits all the methods provided by the generic
- <A HREF="../../../site/lib/Tk/Widget.html">Tk::Widget</A> class.</P>
- <P>
- <HR>
- <H1><A NAME="default bindings">DEFAULT BINDINGS</A></H1>
- <P>Tk automatically creates class bindings for menubuttons that give them
- the following default behavior:</P>
- <DL>
- <DT><STRONG><A NAME="item_%5B1%5D">[1]</A></STRONG><BR>
- <DD>
- A menubutton activates whenever the mouse passes over it and deactivates
- whenever the mouse leaves it.
- <P></P>
- <DT><STRONG><A NAME="item_%5B2%5D">[2]</A></STRONG><BR>
- <DD>
- Pressing mouse button 1 over a menubutton posts the menubutton:
- its relief changes to raised and its associated menu is posted
- under the menubutton. If the mouse is dragged down into the menu
- with the button still down, and if the mouse button is then
- released over an entry in the menu, the menubutton is unposted
- and the menu entry is invoked.
- <P></P>
- <DT><STRONG><A NAME="item_%5B3%5D">[3]</A></STRONG><BR>
- <DD>
- If button 1 is pressed over a menubutton and then released over that
- menubutton, the menubutton stays posted: you can still move the mouse
- over the menu and click button 1 on an entry to invoke it.
- Once a menu entry has been invoked, the menubutton unposts itself.
- <P></P>
- <DT><STRONG><A NAME="item_%5B4%5D">[4]</A></STRONG><BR>
- <DD>
- If button 1 is pressed over a menubutton and then dragged over some
- other menubutton, the original menubutton unposts itself and the
- new menubutton posts.
- <P></P>
- <DT><STRONG><A NAME="item_%5B5%5D">[5]</A></STRONG><BR>
- <DD>
- If button 1 is pressed over a menubutton and released outside
- any menubutton or menu, the menubutton unposts without invoking
- any menu entry.
- <P></P>
- <DT><STRONG><A NAME="item_%5B6%5D">[6]</A></STRONG><BR>
- <DD>
- When a menubutton is posted, its associated menu claims the input
- focus to allow keyboard traversal of the menu and its submenus.
- See the <STRONG>menu</STRONG> documentation for details on these bindings.
- <P></P>
- <DT><STRONG><A NAME="item_%5B7%5D">[7]</A></STRONG><BR>
- <DD>
- If the <STRONG>underline</STRONG> option has been specified for a menubutton
- then keyboard traversal may be used to post the menubutton:
- Alt+<EM>x</EM>, where <EM>x</EM> is the underlined character (or its
- lower-case or upper-case equivalent), may be typed in any window
- under the menubutton's toplevel to post the menubutton.
- <P></P>
- <DT><STRONG><A NAME="item_%5B8%5D">[8]</A></STRONG><BR>
- <DD>
- The F10 key may be typed in any window to post the first menubutton
- under its toplevel window that isn't disabled.
- <P></P>
- <DT><STRONG><A NAME="item_%5B9%5D">[9]</A></STRONG><BR>
- <DD>
- If a menubutton has the input focus, the space and return keys
- post the menubutton.
- <P>If the menubutton's state is <STRONG>disabled</STRONG> then none of the above
- actions occur: the menubutton is completely non-responsive.</P>
- <P>The behavior of menubuttons can be changed by defining new bindings for
- individual widgets or by redefining the class bindings.</P>
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="keywords">KEYWORDS</A></H1>
- <P>menubutton, widget</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::Menubutton - Create and manipulate Menubutton widgets</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-