iwidgets::optionmenu(1)
π iwidgets::optionmenu π
okay so real talk: this is the manual page for iwidgets::optionmenu, and it lives in section 1 of the manual, and it comes from the [incr Widgets] family. She's giving very much "I make dropdown menus and I make them cute." Let's get into it bestie π
β¨ NAME β¨
iwidgets::optionmenu β create and manipulate an option menu widget π
β¨ SYNOPSIS β¨
iwidgets::optionmenu pathName ?options?
π INHERITANCE π
itk::Widget <- iwidgets::Labeledwidget <- iwidgets::Optionmenu
that's the whole family tree, no cap π§
πΈ STANDARD OPTIONS πΈ
these are the classics, the ones every widget shows up with:
activeBackgroundactiveBorderWidthactiveForegroundbackgroundborderWidthcursordisabledForegroundfontforegroundhighlightColorhighlightThicknessrelief
See the options manual entry for the details on all of these, bestie β she's not gonna re-explain them here. π
π INHERITED OPTIONS π
these ones she got from her ancestors:
disabledForegroundlabelBitmaplabelFontlabelImagelabelMarginlabelPoslabelTextlabelVariablestatesticky
See the LabeledWidget manual entry for the details on the inherited options.
lowkey obsessed that the page prints labelFontlabelImage as one giant word β yes, that's exactly how it's printed here, I'm not touching it π«Ά
π¦ WIDGET-SPECIFIC OPTIONS π¦
okay here's where she gets specific. Each one below has a Name, a Class, and a Command-Line Switch.
-clicktimeβ Name:clickTime, Class:ClickTime. This is the interval time, in msec, used to figure out that a single mouse click has actually occurred. It's used to post the menu on a "quick" mouse click. β οΈ Note: changing this value may cause the single-click functionality to not work properly. The default is 150 msec.-commandβ Name:command, Class:Command. Specifies a Tcl command procedure to be evaluated after the current option menu selection changes. iykyk, that's your callback β¨-cycliconβ Name:cyclicOn, Class:CyclicOn. Turns on/off the 3rd mouse button capability. The value may be specified in any of the forms acceptable toTcl_GetBoolean. This feature lets the right mouse button cycle through the popup menu list without popping it up. The right mouse button cycles through the menu in reverse order. The default is true. π₯-popupcursorβ Name:popupCursor, Class:Cursor. Specifies the mouse cursor to be used for the popup menu. The value may have any of the forms acceptable toTk_GetCursor. cursor glow-up, periodt π-stateβ Name:state, Class:State. Specifies one of two states for the optionmenu: normal or disabled. If the optionmenu is disabled, then option menu selection is ignored. π-widthβ Name:width, Class:Width. Specifies a fixed size for the menu button label, in any of the forms acceptable toTk_GetPixels. If the text is too small to fit in the label, the text gets clipped. β οΈ Note: normally, when a new list is created, or new items are added to an existing list, the menu button label is resized automatically β setting this option overrides that functionality. main character energy, she does what she wants π
β¨ DESCRIPTION β¨
The iwidgets::optionmenu command creates an option menu widget with options to manage it. An option menu displays a frame containing a label and a button, and a pop-up menu will allow for the value of the button to change. it's giving dropdown but make it fashion π
π METHODS π
The iwidgets::optionmenu command creates a new Tcl command whose name is pathName. This command may be used to invoke various operations on the widget. It has the following general form:
pathName option ?arg arg ...?
Option and the args determine the exact behavior of the command.
Many of the widget commands for an optionmenu take as one argument an indicator of which entry of the option menu to operate on. These indicators are called indexes and may be specified in any of the following forms:
numberβ Specifies the entry numerically, where0corresponds to the top-most entry of the option menu,1to the entry below it, and so on.endβ Indicates the bottommost entry in the menu. If there are no entries in the menu then-1is returned.selectβ Returns the numerical index of the currently selected option menu entry. If no entries exist in the menu, then-1is returned.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 option menu, in order from the top down, until a matching entry is found. The rules ofTcl_StringMatchare used.
The following widget commands are possible for optionmenu widgets: π«Ά
π WIDGET-SPECIFIC METHODS π
pathName cget optionβ Returns the current value of the configuration option given by option. Option may have any of the values accepted by theiwidgets::optionmenucommand.pathName configure ?option? ?value option value ...?β Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName (seeTk_ConfigureInfofor information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by theiwidgets::optionmenucommand.pathName delete first ?last?β Delete all of the option menu entries between first and last inclusive. If last is omitted then it defaults to first. bye bestie πpathName disable indexβ Disable the option menu entry specified by index. Disabling a menu item will prevent the user from being able to select this item from the menu. This only effects the state of the item in the menu β in other words, should the item be the currently selected item, the programmer is responsible for determining this condition and taking appropriate action. π so yes, that's on youpathName enable indexβ Enable the option menu entry specified by index. Enabling a menu item allows the user to select this item from the menu.pathName get ?first? ?last?β If no arguments are specified, this operation returns the currently selected option menu item. Otherwise, it returns the name of the option at index first, or a range of options between first and last.pathName index indexβ Returns the numerical index corresponding to index.pathName insert index string ?string?β Insert an item, or list of items, into the menu at location index.pathName select indexβ Select an item from the option menu to be displayed as the currently selected item.pathName sort modeβ Sort the current menu in either ascending, or descending order. The valuesincreasing, ordecreasingare also accepted.
π§ COMPONENTS π§
menuBtnβ Class:Menubutton. ThemenuBtncomponent is the option menu button which displays the current choice from the popup menu. See themenubuttonwidget manual entry for details on themenuBtncomponent item.popupMenuβ Class:Menu. ThepopupMenucomponent is the menu displayed upon selection of the menu button. The menu contains the choices for the option menu. See themenuwidget manual entry for details on thepopupMenucomponent item.
β EXAMPLE β
package require Iwidgets 4.0
iwidgets::optionmenu .om -labelmargin 5 \
-labelon true -labelpos w -labeltext "Operating System :"
.om insert end Unix VMS Linux OS/2 {Windows NT} DOS
.om sort ascending
.om select Linux
pack .om -padx 10 -pady 10
ate that example fr fr π₯
π ACKNOWLEDGEMENTS: π
- Michael J. McLennan β Borrowed some ideas (next & previous) from OptionButton class.
- Steven B. Jaggers β Provided an initial prototype in
[incr Tcl]. - Bret Schuhmacher β Helped with popup menu functionality.
π AUTHOR π
Alfredo Jahn
πΈ KEYWORDS πΈ
optionmenu, widget
okay that's the whole page bestie, every single option and method and index form accounted for π this was shipped out from the Tk corner of the world as page iwidgets::optionmenu(1) β go forth and build cute dropdowns, you're gonna slay β¨ππ¦
π¦ where this page comes from
- debian bookworm: iwidgets4-doc 4.1.1-2.1
- debian trixie: iwidgets4-doc 4.1.1-4
- ubuntu jammy: iwidgets4-doc 4.1.1-2.1
- ubuntu noble: iwidgets4-doc 4.1.1-2.1
- ubuntu resolute: iwidgets4-doc 4.1.1-4
- ubuntu stonking: iwidgets4-doc 4.1.1-4
- Copyright (c) 1995 DSC Technologies Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms