iwidgets::dialog(1)

πŸ’– NAME πŸ’–

iwidgets::dialog β€” bestie, this makes you a dialog widget. That's it, that's the whole job. (It's page one of the [incr Widgets] manual, section 1, so like... iwidgets::dialog(1), iykyk.)


✨ SYNOPSIS ✨

iwidgets::dialog pathName ?options?

🧬 INHERITANCE 🧬

Okay so the family tree is giving ✨legacy✨ and it goes like this, no skipping generations:

itk::Toplevel ← iwidgets::Shell ← iwidgets::Dialogshell ← iwidgets::Dialog


🌸 STANDARD OPTIONS 🌸

  • background
  • cursor
  • foreground

See the "options" manual entry for the deets on those standard options. πŸ’…


πŸ¦‹ INHERITED OPTIONS πŸ¦‹

These cuties came from the dialogshell manual entry:

  • buttonBoxPadX
  • buttonBoxPadY
  • buttonBoxPos
  • padX
  • padY
  • separator
  • thickness

See the "dialogshell" manual entry for details on the above inherited options.

These came from the shell manual entry:

  • height
  • master
  • modality
  • width

See the "shell" manual entry for details on the above inherited options.

And this one came from the Toplevel manual entry:

  • title

See the "Toplevel" manual entry for details on the above inherited options. πŸ‘‘


πŸŽ€ DESCRIPTION πŸŽ€

So iwidgets::dialog creates a dialog box that hands you standard buttons and a child site for use in derived classes. The buttons are ok, apply, cancel, and help. And because we're not savages, there are Methods and Options to configure the buttons and the box that holds them. 🫢


πŸ’… METHODS πŸ’…

The iwidgets::dialog command creates a brand new Tcl command whose name is pathName. That command is your main character and you can use it to invoke a bunch of operations on the widget. The general form is:

pathName option ?arg arg ...?

option and the args decide exactly what the command does. And here's what's possible for dialog widgets: ⬇️

🌈 INHERITED METHODS 🌈

From the buttonbox manual entry:

  • add
  • buttonconfigure
  • defaulthide
  • index
  • insert
  • invoke
  • show

See the "buttonbox" manual entry for details on the above inherited methods.

This one's from the dialogshell manual entry:

  • childsite

See the "dialogshell" manual entry for details on the above inherited methods.

And these are from the shell manual entry:

  • activate
  • center
  • deactivate

See the "shell" manual entry for details on the above inherited methods.


⭐ WIDGET-SPECIFIC METHODS ⭐

  • pathName cget option β€” returns the current value of the configuration option you passed as option. And option can be literally any of the values that the iwidgets::dialog command accepts. No cap. πŸ’«
  • pathName configure ?option? ?value option value ...? β€” query or modify the widget's configuration options.
    • If you specify no option, you get back a list describing all the available options for pathName (see Tk_ConfigureInfo for how that list is formatted, bestie, I'm not typing that out).
    • If you specify an option with no value, the command returns a list describing that one named option β€” and that list will be identical to the corresponding sublist of the value you'd get back if you hadn't specified any option. Same list, different vibe. πŸŽ€
    • If you specify one or more option-value pairs, the command modifies the given widget option(s) to have the given value(s). And in that case? The command returns an empty string. That's it, that's the whole return. πŸ«₯
    • And yeah, option may have any of the values accepted by the iwidgets::dialog command.

πŸ”₯ EXAMPLE πŸ”₯

package require Iwidgets 4.0
iwidgets::dialog .d -modality global
.d buttonconfigure OK -command {puts OK; .d deactivate 1}
.d buttonconfigure Apply -command {puts Apply}
.d buttonconfigure Cancel -command {puts Cancel; .d deactivate 0}
.d buttonconfigure Help -command {puts Help}

listbox [.d childsite].lb -relief sunken
pack [.d childsite].lb -expand yes -fill both

if {[.d activate]} {
    puts "Exit via OK button"
} else {
    puts "Exit via Cancel button"
}

πŸ‘‘ AUTHOR πŸ‘‘

Mark L. Ulferts and Bret A. Schuhmacher β€” absolute icons, we stan. 🫢


πŸ“ KEYWORDS πŸ“

dialog, dialogshell, shell, widget


✨ that's the whole page bestie ✨ This one lives in the Tk source, it's iwidgets::dialog(1), and yeah, it's serving [incr Widgets] energy from start to finish. Go forth and build a dialog. Periodt. πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from