iwidgets::buttonbox(1)

✨ iwidgets::buttonbox ✨

okay bestie, this is the manual page for iwidgets::buttonbox from the [incr Widgets] collection πŸ’– it makes a whole manager widget that holds all your buttons, keeps them cute and organized, and even has a lil default-button moment. no cap.


πŸŽ€ NAME πŸŽ€

iwidgets::buttonbox β€” create and manipulate a manager widget for buttons


🌸 SYNOPSIS 🌸

iwidgets::buttonbox pathName ?options?

πŸ¦‹ INHERITANCE πŸ¦‹

itk::Widget <- iwidgets::buttonbox

so it's giving itk::Widget's whole lineage, and buttonbox is the main character at the end of the chain πŸ‘‘


✨ STANDARD OPTIONS ✨

  • background
  • cursor

these are the standard ones, and if you wanna know the deets, see the "options" manual entry. πŸ“–


πŸ’… WIDGET-SPECIFIC OPTIONS πŸ’…

  • Name: orient Class: Orient Command-Line Switch: -orient

Which way the button box goes: horizontal or vertical. Default is horizontal. lowkey the horizontal one is the default slay.

  • Name: padX Class: PadX Command-Line Switch: -padx

How much non-negative padding space to leave between the button group and the outer edge of the button box, in the x direction. The value can be in any form that Tk_GetPixels accepts. Default is 5 pixels. ✨

  • Name: padY Class: PadY Command-Line Switch: -pady

Same energy, y direction: a non-negative padding distance between the button group and the outer edge of the button box. Value can be anything Tk_GetPixels accepts. Default is 5 pixels. πŸ’–


🌈 DESCRIPTION 🌈

The iwidgets::buttonbox command creates a manager widget for controlling buttons. It also supports displaying and invoking a default button β€” yes, the main character button gets its moment. And the whole box can be configured either horizontally or vertically. periodt.


🫢 METHODS 🫢

The iwidgets::buttonbox command creates a new Tcl command whose name is pathName. You use that command to do literally everything to the widget. General form:

pathName option ?arg arg ...?

option and the args decide what the command actually does. iykyk.

A lot of the widget commands for buttonbox take one argument that says which button of the button box we're operating on. These are called indexes, and they let you reference and manipulate buttons no matter what their current map state is. buttonbox indexes can be written in any of these forms:

  • number β€” specifies the button numerically, where 0 corresponds to the left/top-most button of the button box.
  • end β€” indicates the right/bottom-most button of the button box.
  • default β€” indicates the current default button of the button box. This is the button with the default ring displayed. πŸ‘‘
  • pattern β€” if the index doesn't satisfy any of the forms above, this one gets used. pattern gets pattern-matched against the tag of each button in the button box, in order from left/top to right/left, until a matching entry is found. The rules of Tcl_StringMatch are used. πŸ”

πŸ”₯ WIDGET-SPECIFIC METHODS πŸ”₯

  • pathName add tag args β€” Add a button distinguished by tag to the end of the button box. If there are extra arguments, they specify options to apply to the button. Check out PushButton for the options you can use. πŸ’–
  • pathName buttonconfigure index ?options? β€” This one's like the configure command, except it applies to the options for one individual button, whereas configure applies to the options for the button box as a whole. The options can have any of the values accepted by the PushButton command. If options are specified, they get modified as indicated and the command returns an empty string. If no options are specified, it returns a list describing the current options for entry index (see Tk_ConfigureInfo for the format of that list). πŸŽ€
  • pathName cget option β€” Returns the current value of the configuration option given by option. option can have any of the values accepted by the iwidgets::buttonbox command. ✨
  • pathName configure ?option? ?value option value ...? β€” Query or modify the configuration options of the widget. If no option is specified, it returns a list describing all the available options for pathName (see Tk_ConfigureInfo for the format of that list). If option is specified with no value, the command returns a list describing that one named option β€” and this list is identical to the corresponding sublist of the value returned when no option is specified. If one or more option-value pairs are specified, the command modifies the given widget option(s) to have the given value(s), and in that case it returns an empty string. option can have any of the values accepted by the iwidgets::buttonbox command. πŸ’…
  • pathName default index β€” Sets the default button to the button given by index. This causes the default ring to appear around the specified button. πŸ‘‘βœ¨
  • pathName delete index β€” Deletes the button given by index from the button box. bye bestie 😭
  • pathName hide index β€” Hides the button denoted by index. This doesn't remove the button permanently, just inhibits its display. not gone, just shy πŸ™ˆ
  • pathName index index β€” Returns the numerical index corresponding to index. πŸ”’
  • pathName insert index tag ?option value option value ...? β€” Same as the add command except it inserts the new button just before the one given by index, instead of appending to the end of the button box. The option and value arguments mean the same thing as they do for the add widget command. 🌸
  • pathName invoke ?index? β€” Invoke the command associated with a button. If no arguments are given, the current default button is invoked; otherwise the argument is expected to be a button index. πŸ”₯
  • pathName show index β€” Display a previously hidden button denoted by index. comeback szn πŸ¦‹

🌟 EXAMPLE 🌟

package require Iwidgets 4.0
iwidgets::buttonbox .bb

.bb add Yes -text Yes -command "puts Yes"
.bb add No -text No -command "puts No"
.bb add Maybe -text Maybe -command "puts Maybe"
.bb default Yes

pack .bb -expand yes -fill both

three buttons, one of them is the default, and the whole thing packs itself with -expand yes -fill both. iconic honestly.


πŸ’œ AUTHOR πŸ’œ

Bret A. Schuhmacher Mark L. Ulferts


⭐ KEYWORDS ⭐

buttonbox, pushbutton, button, widget


and that's the whole page bestie!! this one ships from the Tk crew, so shoutout to Tk for keeping iwidgets::buttonbox alive and thriving πŸ’– go forth and build the cutest button box the terminal has ever seen βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from