📄 menubutton.n
字号:
'\"'\" Copyright (c) 1990-1994 The Regents of the University of California.'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) menubutton.n 1.36 97/10/31 12:58:49'\" .so man.macros.TH menubutton n 4.0 Tk "Tk Built-In Commands".BS'\" Note: do not modify the .SH NAME line immediately below!.SH NAMEmenubutton \- Create and manipulate menubutton widgets.SH SYNOPSIS\fBmenubutton\fR \fIpathName \fR?\fIoptions\fR?.SO\-activebackground \-cursor \-highlightthickness \-takefocus\-activeforeground \-disabledforeground \-image \-text\-anchor \-font \-justify \-textvariable\-background \-foreground \-padx \-underline\-bitmap \-highlightbackground \-pady \-wraplength\-borderwidth \-highlightcolor \-relief.SE.SH "WIDGET-SPECIFIC OPTIONS".VS.OP \-direction direction HeightSpecifies where the menu is going to be popup up. \fBabove\fR tries topop the menu above the menubutton. \fBbelow\fR tries to pop the menubelow the menubutton. \fBleft\fR tries to pop the menu to the left ofthe menubutton. \fBright\fR tries to pop the menu to the right of themenu button. \fBflush\fR pops the menu directly over the menubutton..VE.OP \-height height HeightSpecifies a desired height for the menubutton.If an image or bitmap is being displayed in the menubutton then the value is inscreen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);for text it is in lines of text.If this option isn't specified, the menubutton's desired height is computedfrom the size of the image or bitmap or text being displayed in it..OP \-indicatoron indicatorOn IndicatorOnThe value must be a proper boolean value. If it is true thena small indicator rectangle will be displayed on the right sideof the menubutton and the default menu bindings will treat thisas an option menubutton. If false then no indicator will bedisplayed..OP \-menu menu MenuNameSpecifies the path name of the menu associated with this menubutton.The menu must be a child of the menubutton..OP \-state state StateSpecifies one of three states for the menubutton: \fBnormal\fR, \fBactive\fR,or \fBdisabled\fR. In normal state the menubutton is displayed using the\fBforeground\fR and \fBbackground\fR options. The active state istypically used when the pointer is over the menubutton. In active statethe menubutton is displayed using the \fBactiveForeground\fR and\fBactiveBackground\fR options. Disabled state means that the menubuttonshould be insensitive: the default bindings will refuse to activatethe widget and will ignore mouse button presses.In this state the \fBdisabledForeground\fR and\fBbackground\fR options determine how the button is displayed..OP \-width width WidthSpecifies a desired width for the menubutton.If an image or bitmap is being displayed in the menubutton then the value is inscreen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);for text it is in characters.If this option isn't specified, the menubutton's desired width is computedfrom the size of the image or bitmap or text being displayed in it..BE.SH INTRODUCTION.PPThe \fBmenubutton\fR command creates a new window (given by the\fIpathName\fR argument) and makes it into a menubutton widget.Additionaloptions, described above, may be specified on the command lineor in the option databaseto configure aspects of the menubutton such as its colors, font,text, and initial relief. The \fBmenubutton\fR command returns its\fIpathName\fR argument. At the time this command is invoked,there must not exist a window named \fIpathName\fR, but\fIpathName\fR's parent must exist..PPA menubutton is a widget that displays a textual string, bitmap, or imageand is associated with a menu widget.If text is displayed, it must all be in a single font, but itcan occupy multiple lines on the screen (if it contains newlinesor if wrapping occurs because of the \fBwrapLength\fR option) andone of the characters may optionally be underlined using the\fBunderline\fR option. In normal usage, pressingmouse button 1 over the menubutton causes the associated menu tobe posted just underneath the menubutton. If the mouse is moved overthe menu before releasing the mouse button, the button releasecauses the underlying menu entry to be invoked. When the buttonis released, the menu is unposted..PPMenubuttons are typically organized into groups called menu barsthat allow scanning:if the mouse button is pressed over one menubutton (causing itto post its menu) and the mouse is moved over another menubuttonin the same menu bar without releasing the mouse button, then themenu of the first menubutton is unposted and the menu of thenew menubutton is posted instead..PPThere are several interactions between menubuttons and menus; seethe \fBmenu\fR manual entry for information on various menu configurations,such as pulldown menus and option menus..SH "WIDGET COMMAND".PPThe \fBmenubutton\fR command creates a new Tcl command whosename is \fIpathName\fR. Thiscommand may be used to invoke variousoperations on the widget. It has the following general form:.CS\fIpathName option \fR?\fIarg arg ...\fR?.CE\fIOption\fR and the \fIarg\fRsdetermine the exact behavior of the command. The followingcommands are possible for menubutton widgets:.TP\fIpathName \fBcget\fR \fIoption\fRReturns the current value of the configuration option givenby \fIoption\fR.\fIOption\fR may have any of the values accepted by the \fBmenubutton\fRcommand..TP\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?Query or modify the configuration options of the widget.If no \fIoption\fR is specified, returns a list describing all ofthe available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR forinformation on the format of this list). If \fIoption\fR is specifiedwith no \fIvalue\fR, then the command returns a list describing theone named option (this list will be identical to the correspondingsublist of the value returned if no \fIoption\fR is specified). Ifone or more \fIoption\-value\fR pairs are specified, then the commandmodifies the given widget option(s) to have the given value(s); inthis case the command returns an empty string.\fIOption\fR may have any of the values accepted by the \fBmenubutton\fRcommand..SH "DEFAULT BINDINGS".PPTk automatically creates class bindings for menubuttons that give themthe following default behavior:.IP [1]A menubutton activates whenever the mouse passes over it and deactivateswhenever the mouse leaves it..IP [2]Pressing mouse button 1 over a menubutton posts the menubutton:its relief changes to raised and its associated menu is postedunder the menubutton. If the mouse is dragged down into the menuwith the button still down, and if the mouse button is thenreleased over an entry in the menu, the menubutton is unpostedand the menu entry is invoked..IP [3]If button 1 is pressed over a menubutton and then released over thatmenubutton, the menubutton stays posted: you can still move the mouseover the menu and click button 1 on an entry to invoke it.Once a menu entry has been invoked, the menubutton unposts itself..IP [4]If button 1 is pressed over a menubutton and then dragged over someother menubutton, the original menubutton unposts itself and thenew menubutton posts..IP [5]If button 1 is pressed over a menubutton and released outsideany menubutton or menu, the menubutton unposts without invokingany menu entry..IP [6]When a menubutton is posted, its associated menu claims the inputfocus to allow keyboard traversal of the menu and its submenus.See the \fBmenu\fR manual entry for details on these bindings..IP [7]If the \fBunderline\fR option has been specified for a menubuttonthen keyboard traversal may be used to post the menubutton:Alt+\fIx\fR, where \fIx\fR is the underlined character (or itslower-case or upper-case equivalent), may be typed in any windowunder the menubutton's toplevel to post the menubutton..IP [8]The F10 key may be typed in any window to post the first menubuttonunder its toplevel window that isn't disabled..IP [9]If a menubutton has the input focus, the space and return keyspost the menubutton..PPIf the menubutton's state is \fBdisabled\fR then none of the aboveactions occur: the menubutton is completely non-responsive..PPThe behavior of menubuttons can be changed by defining new bindings forindividual widgets or by redefining the class bindings..SH KEYWORDSmenubutton, widget
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -