Menu(3pm)
π Menu(3pm) β Tk::Menu π
okay bestie, gather round, because this is the manual page for Tk::Menu β the thing that lets you create and manipulate Menu widgets β¨ yes, the little dropdowns, the menubars, the whole vibe. it's giving "I control the entire top of your window" and honestly? iconic. π
β¨ SYNOPSIS β¨
$menu = $parent->Menu(?options?);
πΈ STANDARD OPTIONS πΈ
these are the classics, the staples, the everyday slay:
-activebackground-background-disabledforeground-relief-activeborderwidth-borderwidth-font-takefocus-activeforeground-cursor-foreground
if you want the full tea on these, go read Tk::options β it's all there, no cap. π
π WIDGET-SPECIFIC OPTIONS π
these are the ones that are hers specifically, yk? the main character options π
postCommand
- Name:
postCommand - Class:
Command - Switch:
-postcommand
so if you set this option, it gives you a callback that gets executed every single time the menu is posted. the callback is invoked by the post method before posting the menu. and lowkey important: in 8.0 on Macintosh and Windows, all commands in a menu system are executed before any are posted. that's just a limitation of the individual platforms' menu managers, not our fault bestie π
selectColor
- Name:
selectColor - Class:
Background - Switch:
-selectcolor
for menu entries that are check buttons or radio buttons, this option says what color to show in the indicator when that check button or radio button is selected. cute lil detail β¨
tearOff
- Name:
tearOff - Class:
TearOff - Switch:
-tearoff
this one must have a proper boolean value, and it decides whether the menu includes a tear-off entry at the top or not. if it does, that entry exists as entry 0 of the menu, and all the other entries number starting at 1. the default menu bindings are set up so the menu gets torn off when the tear-off entry is invoked. slay, detachable menu π¦
tearOffCommand
- Name:
tearOffCommand - Class:
TearOffCommand - Switch:
-tearoffcommand
if this option has a non-empty value, then it specifies a perl/Tk callback to invoke whenever the menu is torn off. the actual command will be: the value of this option, then a space, then the name of the menu window, then a space, then the name of the name of the torn off menu window. for example β if the option's is a b'' and menu `.x.y` is torn off to create a new menu `.x.tearoff1`, then the command a b .x.y .x.tearoff1'' will be invoked. fr fr, that's the exact string. π«Ά
title
- Name:
title - Class:
Title - Switch:
-title
the string gets used to title the window that's created when this menu is torn off. but if the title is NULL, then the window will just have the title of the menubutton, or the text of the cascade item from which this menu was invoked. okay flexible queen π
type
- Name:
type - Class:
Type - Switch:
-type
this option can be one of menubar, tearoff, or normal, and it's set when the menu is created. now listen β while the string returned by the configuration database will change if this option is changed, that does not affect the menu widget's behavior. it's used by the cloning mechanism and is not normally set outside of the Tk library. so likeβ¦ don't touch it unless you know what you're doing bestie π
π DESCRIPTION π
the Menu method creates a new top-level window (given by the $widget argument) and makes it into a menu widget. extra options β the ones described above β can be specified on the command line or in the option database to configure stuff like the menu's colors and font. the menu command returns its $widget argument. and when this command is invoked, there must not already exist a window named $widget, but $widget's parent must exist. rules are rules. π
a menu is a widget that displays a collection of one-line entries arranged in one or more columns. there are several different types of entries, each with different properties. you can combine entries of different types in a single menu β mixing and matching is allowed, we love versatility. but heads up: menu entries are not the same as entry widgets. in fact, menu entries aren't even distinct widgets β the entire menu is one widget. plot twist π
menu entries are displayed with up to three separate fields:
- the main field is a label, in the form of a text string, a bitmap, or an image, controlled by the
-label,-bitmap, and-imageoptions for the entry. - if the
-acceleratoroption is specified for an entry, then a second textual field shows up to the right of the label. the accelerator typically describes a keystroke sequence you can type in the application to cause the same result as invoking the menu entry. shortcut queen β¨οΈ - the third field is an indicator. it's only there for checkbutton or radiobutton entries. it shows whether the entry is selected or not, and it's displayed to the left of the entry's string.
in normal use, an entry becomes active (displays itself differently) whenever the mouse pointer is over the entry. if a mouse button is released over the entry, then the entry is invoked. the effect of invocation is different for each type of entry β and those effects are described below in the sections on individual entries. stay tuned. π
entries may be disabled, which makes their labels and accelerators display with dimmer colors. the default menu bindings will not let a disabled entry be activated or invoked. but disabled entries can be re-enabled, at which point you can activate and invoke them again. she's back, your honor π₯
whenever a menu's active entry changes, a <<MenuSelect>> virtual event is sent to the menu. the active item can then be queried from the menu, and you can take an action β like setting context-sensitive help text for that entry. the way that it's just quietly doing all this for you π
π COMMAND ENTRIES π
the most common kind of menu entry is a command entry, which behaves a lot like a button widget. when a command entry is invoked, a callback is executed. the callback is specified with the -command option. simple, classic, effective. β¨
π§ SEPARATOR ENTRIES π§
a separator is an entry displayed as a horizontal dividing line. a separator may not be activated or invoked, and it has no behavior other than its display appearance. it's literally just there for the aesthetic, and honestly? relatable. π
β CHECKBUTTON ENTRIES β
a checkbutton menu entry behaves a lot like a checkbutton widget. when it's invoked, it toggles back and forth between the selected and deselected states. when the entry is selected, a particular value gets stored in a particular global variable (as determined by the -onvalue and -variable options for the entry); when the entry is deselected, a different value (determined by the -offvalue option) gets stored in the global variable.
an indicator box is displayed to the left of the label in a checkbutton entry. if the entry is selected, the indicator's center is displayed in the color given by the -selectcolor option for the entry; otherwise the indicator's center is displayed in the background color for the menu. and if a -command option is specified for a checkbutton entry, its value is evaluated each time the entry is invoked β and that happens after toggling the entry's selected state. order matters bestie π
πΈ RADIOBUTTON ENTRIES πΈ
a radiobutton menu entry behaves a lot like a radiobutton widget. radiobutton entries are organized into groups, and only one entry per group may be selected at a time. whenever a particular entry becomes selected, it stores a particular value into a particular global variable (as determined by the -value and -variable options for the entry). this action causes any previously-selected entry in the same group to deselect itself. and once an entry has become selected, any change to the entry's associated variable will cause the entry to deselect itself. she's loyal to the variable, not to you π
grouping of radiobutton entries is determined by their associated variables: if two entries have the same associated variable, then they're in the same group. that's the whole system, no cap.
an indicator diamond is displayed to the left of the label in each radiobutton entry. if the entry is selected, the indicator's center is displayed in the color given by the -selectcolor option for the entry; otherwise it's displayed in the background color for the menu. and if a -command option is specified for a radiobutton entry, its value is evaluated each time the entry is invoked β this happens after selecting the entry. π
π¦ CASCADE ENTRIES π¦
a cascade entry is one with an associated menu (determined by the -menu option). cascade entries let you build cascading menus β menus inside menus, the inception of it all. the postcascade method can be used to post and unpost the associated menu just next to of the cascade entry. important: the associated menu must be a child of the menu containing the cascade entry (this is needed in order for menu traversal to work correctly). don't skip that part, it'll break things π
a cascade entry posts its associated menu by invoking
$menu->post(x,y)
where menu is the path name of the associated menu, and x and y are the root-window coordinates of the upper-right corner of the cascade entry. on Unix, the lower-level menu is unposted by executing
$menu->unpost
where menu is the name of the associated menu. on other platforms, the platform's native code takes care of unposting the menu. delegation, we love to see it π
if a -command option is specified for a cascade entry, then it's evaluated whenever the entry is invoked. heads up though: this is not supported on Windows. π«
π TEAR-OFF ENTRIES π
a tear-off entry appears at the top of the menu if enabled with the tearOff option. it's not like other menu entries, because it can't be created with the add method and can't be deleted with the delete method. she plays by her own rules π
when a tear-off entry is created it appears as a dashed line at the top of the menu. under the default bindings, invoking the tear-off entry causes a torn-off copy to be made of the menu and all of its submenus. literally duplicating herself, main character energy fr π¦
π MENUBARS π
any menu can be set as a menubar for a toplevel window (see the Toplevel constructor for syntax). on the Macintosh, whenever the toplevel is in front, this menu's cascade items will appear in the menubar across the top of the main monitor. on Windows and Unix, this menu's items will be displayed in a menubar accross the top of the window. these menus behave according to the interface guidelines of their platforms. and for every menu set as a menubar, a clone menu is made β see "CLONES" for more info. yes, there are clones. we'll get to that. π
as noted, menubars may behave differently on different platforms. one example of this concerns the handling of checkbuttons and radiobuttons within the menu. while it's permitted to put these menu elements on menubars, they may not be drawn with indicators on some platforms, due to system restrictions. so if your little checkbox indicator ghosts you, that's why π
π SPECIAL MENUS IN MENUBARS π
certain menus in a menubar get treated specially. on the Macintosh, access to the special Apple and Help menus is provided. on Windows, access to the Windows System menu in each window is provided. on X Windows, a special right-justified help menu is provided. in all cases, these menus must be created with the command name of the menubar menu concatenated with the special name. so:
- for a menubar named
.menubar, on the Macintosh, the special menus would be.menubar.appleand.menubar.help - on Windows, the special menu would be
.menubar.system - on X Windows, the help menu would be
.menubar.help
naming conventions are everything, bestie β¨
So when Tk spots an Apple menu on the Macintosh, that menu's contents become the first items of the Apple menu on screen β but only whenever the window holding the menubar is in front. It's the first menu the user sees, and its title is an Apple logo. π After all the Tk-defined items, the menu gets a separator, and then every item from the user's Apple Menu Items folder shows up.
Now the tea β: because the System uses a totally different menu definition procedure for the Apple menu than Tk uses for its own menus, and the system APIs don't fully support everything Tk tries to do, the menu item will only have its text displayed. No font attributes, no images, no bitmaps, no colors. Nope. And a menu with a tearoff item will show that tearoff item displayed as (TearOff). That's it. That's the whole glow-up it's getting. π
When Tk sees a Help menu on the Macintosh, the menu's contents get appended to the standard help menu over on the right of the user's menubar β whenever the user's menubar is in front, bestie. The first items in the menu are provided by Apple. And similar to the Apple Menu, customization in this menu is limited to what the system provides. π
When Tk sees a System menu on Windows, its items are appended to the system menu that the menubar is attached to. This menu has an icon representing a spacebar, and can be invoked with the mouse or by typing Alt+Spacebar. But due to limitations in the Windows API, any font changes, colors, images, bitmaps, or tearoff images will not appear in the system menu. Periodt. π
When Tk sees a Help menu on X Windows, the menu is moved to be last in the menubar and is right justified. Simple as that. β¨
π CLONES π
Okay so when a menu is set as a menubar for a toplevel window, or when a menu is torn off, a clone of the menu is made. π
This clone is a menu widget in its own right, but it is a child of the original. Changes in the configuration of the original are reflected in the clone β they're linked like that, fr fr. π Additionally, any cascades that are pointed to are also cloned so that menu traversal will work right.
And when do clones get destroyed? When either the tearoff or menubar goes away, or when the original menu is destroyed. Gone. π
π οΈ WIDGET METHODS π οΈ
The Menu method creates a widget object. This object supports the configure and cget methods described in Tk::options which can be used to enquire and modify the options described above. The widget also inherits all the methods provided by the generic Tk::Widget class, and the Tk::Wm class. Slay. π
Many of the methods for a menu take as one argument an indicator of which entry of the menu to operate on. These indicators are called indexes and may be specified in any of the following forms:
number
Specifies the entry numerically, where 0 corresponds to the top-most entry of the menu, 1 to the entry below it, and so on. Count from the top, bestie. π’
active
Indicates the entry that is currently active. If no entry is active then this form is equivalent to none. This form may not be abbreviated. π«
end
Indicates the bottommost entry in the menu. If there are no entries in the menu then this form is equivalent to none. This form may not be abbreviated. π«
last
Same as end. π«
none
Indicates "no entry at all" β this is used most commonly with the activate option to deactivate all the entries in the menu. In most cases the specification of none causes nothing to happen in the method. This form may not be abbreviated. π«
@number
In this form, number is treated as a y-coordinate in the menu's window; the entry closest to that y-coordinate is used. For example, @0 indicates the top-most entry in the window. π
pattern
If the index doesn't satisfy one of the above forms then this form is used. Pattern is pattern-matched against the label of each entry in the menu, in order from the top down, until a matching entry is found. (In perl/Tk the matching is under review, but exact match should work.) π
The following methods are possible for menu widgets:
$menu->activate(index)
Change the state of the entry indicated by index to active and redisplay it using its active colors. Any previously-active entry is deactivated. If index is specified as none, or if the specified entry is disabled, then the menu ends up with no active entry. Returns an empty string. β¨
$menu->add(type, ?option, value, option, value, ...?)
Add a new entry to the bottom of the menu. The new entry's type is given by type and must be one of cascade, checkbutton, command, radiobutton, or separator, or a unique abbreviation of one of the above. If additional arguments are present, they specify any of the following options:
-activebackground => valueβ Specifies a background color to use for displaying this entry when it is active. If this option is specified as an empty string (the default), then theactiveBackgroundoption for the overall menu is used. If the$Tk::strictMotifvariable has been set to request strict Motif compliance, then this option is ignored and the-backgroundoption is used in its place. This option is not available forseparatoror tear-off entries. π¨-activeforeground => valueβ Specifies a foreground color to use for displaying this entry when it is active. If this option is specified as an empty string (the default), then theactiveForegroundoption for the overall menu is used. This option is not available forseparatoror tear-off entries. π¨-accelerator => valueβ Specifies a string to display at the right side of the menu entry. Normally describes an accelerator keystroke sequence that may be typed to invoke the same function as the menu entry. This option is not available forseparatoror tear-off entries. β¨οΈ-background => valueβ Specifies a background color to use for displaying this entry when it is in the normal state (neither active nor disabled). If this option is specified as an empty string (the default), then thebackgroundoption for the overall menu is used. This option is not available forseparatoror tear-off entries. π¨-bitmap => valueβ Specifies a bitmap to display in the menu instead of a textual label, in any of the forms accepted byTk_GetBitmap. This option overrides the-labeloption but may be reset to an empty string to enable a textual label to be displayed. If a-imageoption has been specified, it overrides-bitmap. This option is not available forseparatoror tear-off entries. πΌοΈ-columnbreak => valueβ When this option is zero, the appears below the previous entry. When this option is one, the menu appears at the top of a new column in the menu. π-compound => valueβ Specifies whether the button should display both an image and text, and if so, where the image should be placed relative to the text. Valid values for this option arebottom,center,left,none,rightandtop. The default value isnone, meaning that the button will display either an image or text, depending on the values of the-imageand-bitmapoptions. π§©-command => valueβ Forcommand,checkbutton, andradiobuttonentries, specifies a callback to execute when the menu entry is invoked. Forcascadeentries, specifies a callback to execute when the entry is activated (i.e. just before its submenu is posted). Not available forseparatoror tear-off entries. π₯-font => valueβ Specifies the font to use when drawing the label or accelerator string in this entry. If this option is specified as an empty string (the default) then thefontoption for the overall menu is used. This option is not available forseparatoror tear-off entries. π€-foreground => valueβ Specifies a foreground color to use for displaying this entry when it is in the normal state (neither active nor disabled). If this option is specified as an empty string (the default), then theforegroundoption for the overall menu is used. This option is not available forseparatoror tear-off entries. π¨-hidemargin => valueβ Specifies whether the standard margins should be drawn for this menu entry. This is useful when creating palette with images in them, i.e., color palettes, pattern palettes, etc.1indicates that the margin for the entry is hidden;0means that the margin is used. π-image => valueβ Specifies an image to display in the menu instead of a text string or bitmap. The image must have been created by some previous invocation ofimage create. This option overrides the-labeland-bitmapoptions but may be reset to an empty string to enable a textual or bitmap label to be displayed. This option is not available forseparatoror tear-off entries. πΌοΈ-indicatoron => valueβ Available only forcheckbuttonandradiobuttonentries. Value is a boolean that determines whether or not the indicator should be displayed. β-label => valueβ Specifies a string to display as an identifying label in the menu entry. Not available forseparatoror tear-off entries. π·οΈ-menu => valueβ Available only forcascadeentries. Specifies the path name of the submenu associated with this entry. The submenu must be a child of the menu. π³-offvalue => valueβ Available only forcheckbuttonentries. Specifies the value to store in the entry's associated variable when the entry is deselected. β¬-onvalue => valueβ Available only forcheckbuttonentries. Specifies the value to store in the entry's associated variable when the entry is selected. π©-selectcolor => valueβ Available only forcheckbuttonandradiobuttonentries. Specifies the color to display in the indicator when the entry is selected. If the value is an empty string (the default) then theselectColoroption for the menu determines the indicator color. π¨-selectimage => valueβ only for checkbutton and radiobutton entries, bestie. Specifies an image to display in the entry (in place of the-imageoption) when it is selected.valueis the name of an image, which must have been created by some previous invocation ofimage create. This option is ignored unless the-imageoption has been specified. π-state => valueβ Specifies one of three states for the entry:normal,active, ordisabled. In normal state the entry is displayed using theforegroundoption for the menu and thebackgroundoption from the entry or the menu. The active state is typically used when the pointer is over the entry. In active state the entry is displayed using theactiveForegroundoption for the menu along with theactivebackgroundoption from the entry. Disabled state means that the entry should be insensitive: the default bindings will refuse to activate or invoke the entry. In this state the entry is displayed according to thedisabledForegroundoption for the menu and thebackgroundoption from the entry. This option is not available for separator entries. β¨-underline => valueβ Specifies the integer index of a character to underline in the entry. This option is also queried by the default bindings and used to implement keyboard traversal.0corresponds to the first character of the text displayed in the entry,1to the next character, and so on. If a bitmap or image is displayed in the entry then this option is ignored. This option is not available for separator or tear-off entries. π-value => valueβ Available only for radiobutton entries. Specifies the value to store in the entry's associated variable when the entry is selected. If an empty string is specified, then the-labeloption for the entry as the value to store in the variable.-variable => valueβ Available only for checkbutton and radiobutton entries. Specifies the name of a global value to set when the entry is selected. For checkbutton entries the variable is also set when the entry is deselected. For radiobutton entries, changing the variable causes the currently-selected entry to deselect itself. π
The add method returns an empty string.
$menu->clone($parent ?, cloneType?)β Makes a clone of the current menu as a child of$parent. This clone is a menu in its own right, but any changes to the clone are propogated to the original menu and vice versa.cloneTypecan benormal,menubar, ortearoff. Should not normally be called outside of the Tk library. See "CLONES" for more information. π§$menu->delete(index1?, index2?)β Delete all of the menu entries betweenindex1andindex2inclusive. Ifindex2is omitted then it defaults toindex1. Attempts to delete a tear-off menu entry are ignored (instead, you should change thetearOffoption to remove the tear-off entry).$menu->entrycget(index, option)β Returns the current value of a configuration option for the entry given byindex.Optionmay have any of the values accepted by theaddmethod.$menu->entryconfigure(index ?,options?)β This method is similar to theconfiguremethod, except that it applies to the options for an individual entry, whereasconfigureapplies to the options for the menu as a whole.Optionsmay have any of the values accepted by theaddmethod. If options are specified, options are modified as indicated in the method call and the method returns an empty string. If no options are specified, returns a list describing the current options for entryindex(seeTk::optionsfor information on the format of this list).$menu->index(index)β Returns the numerical index corresponding toindex, ornoneifindexwas specified asnone.$menu->insert(index, type?, -option=>value, ...?)β Same as theaddmethod except that it inserts the new entry just before the entry given byindex, instead of appending to the end of the menu. Thetype,-option, andvaluearguments have the same interpretation as for theaddwidget method. It is not possible to insert new menu entries before the tear-off entry, if the menu has one.$menu->invoke(index)β Invoke the action of the menu entry. See the sections on the individual entries above for details on what happens. If the menu entry is disabled then nothing happens. If the entry has a callback associated with it then the result of that callback is returned as the result of theinvokewidget method. Otherwise the result is an empty string. Note: invoking a menu entry does not automatically unpost the menu; the default bindings normally take care of this before invoking theinvokemethod.$menu->post(x, y)β Arrange for the menu to be displayed on the screen at the root-window coordinates given byxandy. These coordinates are adjusted if necessary to guarantee that the entire menu is visible on the screen. This method normally returns an empty string. If thepostCommandoption has been specified, then its value is executed before posting the menu and the result of that callback is returned as the result of thepostwidget method. If an error returns while executing the method, then the error is returned without posting the menu.$menu->postcascade(index)β Posts the submenu associated with the cascade entry given byindex, and unposts any previously posted submenu. Ifindexdoesn't correspond to a cascade entry, or if$menuisn't posted, the method has no effect except to unpost any currently posted submenu.$menu->type(index)β Returns the type of the menu entry given byindex. This is thetypeargument passed to theaddwidget method when the entry was created, such ascommandorseparator, ortearofffor a tear-off entry.$menu->unpostβ Unmap the window so that it is no longer displayed. If a lower-level cascaded menu is posted, unpost that menu. Returns an empty string. This method does not work on Windows and the Macintosh, as those platforms have their own way of unposting menus. π$menu->yposition(index)β Returns a decimal string giving the y-coordinate within the menu window of the topmost pixel in the entry specified byindex.
π MENU CONFIGURATIONS π
The default bindings support four different ways of using menus:
Pulldown Menus in Menubar
This is the most command case. You create a menu widget that will become the menu bar. You then add cascade entries to this menu, specifying the pull down menus you wish to use in your menu bar. You then create all of the pulldowns. Once you have done this, specify the menu using the -menu option of the toplevel's method. See the toplevel manual entry for details. π
Pulldown Menus in Menu Buttons
This is the compatible way to do menu bars. You create one menubutton widget for each top-level menu, and typically you arrange a series of menubuttons in a row in a menubar window. You also create the top-level menus and any cascaded submenus, and tie them together with -menu options in menubuttons and cascade menu entries. The top-level menu must be a child of the menubutton, and each submenu must be a child of the menu that refers to it. Once you have done this, the default bindings will allow users to traverse and invoke the tree of menus via its menubutton; see the menubutton documentation for details. π«Ά
Popup Menus
Popup menus typically post in response to a mouse button press or keystroke. You create the popup menus and any cascaded submenus, then you call the Post method at the appropriate time to post the top-level menu.
$menu->Post($x,$y?,$entry?)
$x and $y are the root window coordinates at which the $menu will be displayed. If $entry is specified then that entry is centred on that point, otherwise the top-left corner of the $menu is placed at that point.
Menu also inherits methods from Tk::Wm and so the method Popup can be used to position menu relative to other windows, the mouse cursor or the screen. β¨
Option Menus
An option menu consists of a menubutton with an associated menu that allows you to select one of several values. The current value is displayed in the menubutton and is also stored in a global variable. Use the Tk::Optionmenu class to create option menubuttons and their menus. π
Torn-off Menus
You create a torn-off menu by invoking the tear-off entry at the top of an existing menu. The default bindings will create a new menu that is a copy of the original menu and leave it permanently posted as a top-level window. The torn-off menu behaves just the same as the original menu. π
π¦ DEFAULT BINDINGS π¦
Tk is out here doing the absolute most for you, bestie β it automatically creates class bindings for menus that give them this default behavior. No cap, you literally don't have to do anything π
- When the mouse enters a menu, the entry underneath the mouse cursor activates; as the mouse moves around the menu, the active entry changes to track the mouse. It's giving stalker but make it helpful β¨
- When the mouse leaves a menu all of the entries in the menu deactivate β except in the special case where the mouse moves from a menu to a cascaded submenu. That one's the exception, iykyk.
- When a button is released over a menu, the active entry (if any) is invoked. The menu also unposts unless it is a torn-off menu. torn-off menus stay posted fr fr
- The Space and Return keys invoke the active entry and unpost the menu. Keyboard girlies stay winning β¨οΈπ
- If any of the entries in a menu have letters underlined with with
-underlineoption, then pressing one of the underlined letters (or its upper-case or lower-case equivalent) invokes that entry and unposts the menu. mnemonic moment - The Escape key aborts a menu selection in progress without invoking any entry. It also unposts the menu unless it is a torn-off menu. escape = the universal "nvm" π«Ά
- The Up and Down keys activate the next higher or lower entry in the menu. When one end of the menu is reached, the active entry wraps around to the other end. looping behavior, iconic
- The Left key moves to the next menu to the left. If the current menu is a cascaded submenu, then the submenu is unposted and the current menu entry becomes the cascade entry in the parent. If the current menu is a top-level menu posted from a menubutton, then the current menubutton is unposted and the next menubutton to the left is posted. Otherwise the key has no effect. The left-right order of menubuttons is determined by their stacking order: Tk assumes that the lowest menubutton (which by default is the first one created) is on the left.
- The Right key moves to the next menu to the right. If the current entry is a cascade entry, then the submenu is posted and the current menu entry becomes the first entry in the submenu. Otherwise, if the current menu was posted from a menubutton, then the current menubutton is unposted and the next menubutton to the right is posted.
Disabled menu entries are non-responsive: they don't activate and they ignore mouse button presses and releases. No vibes detected, they are simply not participating π
The behavior of menus can be changed by defining new bindings for individual widgets or by redefining the class bindings. Go off, customize it, make it yours π
π BUGS π
At present it isn't possible to use the option database to specify values for the options to individual entries.
Yeah bestie, that's justβ¦ not a thing yet. We don't make the rules π
π SEE ALSO π
Tk::callbacks
β¨ KEYWORDS β¨
menu, widget
and that's the whole page, babe π This lil masterpiece is from perl v5.40.1, dated 2025-04-13, and it lives at Menu(3pm). Go forth and build menus that eat, bestie π
β¨π¦
π¦ where this page comes from
- debian trixie: perl-tk 1:804.036+dfsg1-5
- ubuntu questing: perl-tk 1:804.036+dfsg1-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms