tep...gbox(3tcl)
β¨ NAME β¨
okay so bestie, this is the tepam::argument_dialogbox manual page β TEPAM argument_dialogbox, reference manual. π It's part of Tcl's Enhanced Procedure and Argument Manager, and it's literally the main character of your Tk data entry forms. π«Ά No cap.
πΈ SYNOPSIS πΈ
the vibe check starts here β you gotta have these packages, fr fr:
package require Tcl 8.5 9
package require Tk 8.3
package require tepam ?0.5?
And here are the two ways to call it, bestie:
tepam::argument_dialogbox item_name item_attributes ?item_name
item_attributes? ?...?
tepam::argument_dialogbox {item_name item_attributes ?item_name
item_attributes? ?...?}
π DESCRIPTION π
π₯ ARGUMENT DIALOGBOX CALL π₯
okay so the TEPAM argument_dialogbox is a flexible and easily usable data entry form generator that's available if Tk has been loaded. Periodt. Each data entry element of a form is defined via a data entry item that you can hand over to <code>argument_dialogbox</code> in two formats:
First format:
tepam::argument_dialogbox item_name item_attributes ?item_name
item_attributes? ?...?
Using this first format, each data entry item is defined via a pair of two arguments. The first one is the item name that defines the entry widget that has to be used in the form. The second argument, called item attributes, specifies the variable which is attributed to the data entry element as well as eventual formatting and context information.
The <code>argument_dialogbox</code> returns ok if the entered data have been acknowledged (via the OK button) and validated by a data checker. If the entered data have been rejected (via the Cancel button) the <code>argument_dialogbox</code> returns cancel.
A small example illustrates how the <code>argument_dialogbox</code> can be employed:
set DialogResult [tepam::argument_dialogbox \
-title "Itinerary selection" \
-file {-label "Itinerary report" -variable report_file} \
-frame {-label "Itinerary start"} \
-comment {-text "Specify your itinerary start location"} \
-entry {-label "City" -variable start_city -type string} \
-entry {-label "Street" -variable start_street -type string -optional 1} \
-entry {-label "Street number" -variable start_street_nbr -type integer -optional 1} \
-frame {-label "Itinerary destination"} \
-comment {-text "Specify your itinerary destination"} \
-entry {-label "City" -variable dest_city -type string} \
-entry {-label "Street" -variable dest_street -type string -optional 1} \
-entry {-label "Street number" -variable dest_street_nbr -type integer -optional 1} \
-frame {} \
-checkbutton {-label "Don't use highways" -variable no_highway}]
This example opens a dialog box that has the title Itinerary selection. A first entry widget in this box allows selecting a report file. It follows two frames to define respectively an itinerary start and end location. Each of these locations that are described with a comment has three entry widgets to specify respectively the city, street and the street number. Below the second frame there is a check button that allows specifying if eventual highways should be ignored. <emoji>π¦</emoji>
Second format:
tepam::argument_dialogbox {item_name item_attributes ?item_name
item_attributes? ?...?}
Sometimes it is simpler to provide all the data entry item definitions in form of a single list to <code>argument_dialogbox</code>, and not as individual arguments. The second format that is supported by <code>argument_dialogbox</code> corresponds exactly to the first one, except that all item definitions are packed into a single list that is provided to <code>argument_dialogbox</code>. The previous example can therefore also be written in the following way:
set DialogResult [tepam::argument_dialogbox {
-title "Itinerary selection"
-file {-label "Itinerary report" -variable report_file}
...
-checkbutton {-label "Don't use highways" -variable no_highway} }]
The commands <code>argument_dialogbox</code> as well as <code>procedure</code> are exported from the namespace <code>tepam</code>. To use these commands without the <code>tepam::</code> namespace prefix, it is sufficient to import them into the main namespace:
namespace import tepam::*
set DialogResult [argument_dialogbox \
-title "Itinerary selection"
...
The following subsections explain the different argument item types that are accepted by the <code>argument_dialogbox</code>, classified into three groups. The first data entry item definition format will be used in the remaining document, knowing that this format can always be transformed into the second format by putting all arguments into a single list that is then provided to <code>argument_dialogbox</code>.
π¦ CONTEXT DEFINITION ITEMS π¦
The first item group allows specifying some context aspects of an argument dialog box. These items are taking a simple character string as item attribute:
tepam::argument_dialogbox \
-<argument_name> string \
...
The following items are classified into this group:
-titlestring β The dialog box window title which is by default <code>Dialog</code> can be changed with the-titleitem:
tepam::argument_dialogbox \
-title "System configuration" \
...
-windowstring β The argument dialog box uses by default <code>.dialog</code> as dialog top level window. This path can be changed with the-windowitem:
tepam::argument_dialogbox \
-window .dialog \
...
-parentstring β By defining a parent window, the argument dialog box will be displayed beside this one. Without explicit parent window definition, the top-level window will be considered as parent window.
tepam::argument_dialogbox \
-parent .my_appl \
...
-contextstring β If a context is defined the dialog box state, e.g. the entered data as well as the window size and position, is restored the next time the argument dialog box is called. The assignment of a context allows saving the dialog box state in its context to distinguish between different usages of the argument dialog box.
tepam::argument_dialogbox \
-context destination_definitions \
...
π FORMATTING AND DISPLAY OPTIONS π
Especially for big, complex forms it becomes important that the different data entry widgets are graphically well organized and commented to provide an immediate and clear overview to the user. A couple of items allow structuring and commenting the dialog boxes.
The items of this classification group require as item attributes a definition list, which contains itself attribute name and value pairs:
tepam::argument_dialogbox \
...
-<argument_name> {
?-<attribute_name> <attribute_value>?
?-<attribute_name> <attribute_value>?
?...?
}
...
The following items are classified into this group:
-framelist β The-frameitem allows packing all following entry widgets into a labeled frame, until a next frame item is defined or until the last entry widget has been defined. It recognizes the following attributes inside the item attribute list:-labelstring β An optional frame label can be specified with the-labelstatement.
Example:
tepam::argument_dialogbox \
...
-frame {-label "Destination address"}
...
To close an open frame without opening a new one, an empty list has to be provided to the -frame statement.
tepam::argument_dialogbox \
...
-frame {}
...
-sep[const {{}}]β Entry widgets can be separated with the-sepstatement which doesn't require additional definitions. The related definition list has to exist, but its content is ignored.
tepam::argument_dialogbox \
...
-sep {}
...
-commentstring β Comments and descriptions can be added with the-textattribute of the-commentitem. Please note that each entry widget itself can also contain a-textattribute for comments and descriptions. But the-commentitem allows for example adding a description between two frames.
tepam::argument_dialogbox \
...
-comment {-text "Specify bellow the destination address"}
...
-yscroll0|1|autoβ This attribute allows controlling an eventual vertical scrollbar. Setting it to0will permanently disable the scrollbar, setting it to1will enable it. By default it is set toauto. The scrollbar is enabled in this mode only if the vertical data entry form size exceeds66%of the screen height.
tepam::argument_dialogbox \
...
-yscroll auto
...
π GLOBAL CUSTOM DATA VALIDATION π
This item group allows specifying global custom checks to validate the entered data.
-validatecommandscript β Custom data checks can be performed via validation commands that are defined with the-validatecommanditem. Example:
tepam::argument_dialogbox \
-entry {-label "Your comment" -variable YourCom} \
-validatecommand {IllegalWordDetector $YourCom}
The validation command is executed in the context of the calling procedure, once all the basic data checks have been performed and data variables are assigned. All data is accessed via the data variables. Note that there is also an entry widget specific attribute -validatecommand that allows declaring custom checks for specific data entries.
The attribute -validatecommand can be repeated to declare multiple custom checks.
-validatecommand_error_textstring β This item allows overriding the default error message for a global custom argument validation (defined by-validatecommand). Also this attribute can be repeated in case multiple checks are declared.-validatecommand2script-validatecommand2_error_textstring β These items are mainly for TEPAM internal usage.
These items correspond respectively to -validatecommand and -validatecommand_error_text. However, the data validation is not performed in the next upper stack level, but two stack levels higher.
π DATA ENTRY WIDGET ITEMS π
okay so data entry widgets? they get created with the widget items, bestie. and every single one of them needs a definition list handed to it as its item attributes β that list is literally just attribute-name-and-value pairs stacked up, no cap:
tepam::argument_dialogbox \
...
-<argument_name> {
?-<attribute_name> <attribute_value>?
?-<attribute_name> <attribute_value>?
?...?
}
...
That attribute list can carry all kinds of stuff β it describes an entry widget, comments on it, and constrains whatever value somebody types into it. And the shared set of attributes that every entry widget accepts? Those live in the section Entry Widget Item Attributes β go read it, it's giving required reading. π«Ά
TEPAM comes with a whole rich set of entry widgets π and if that's not enough for you, the set can be extended with extra application specific entry widgets (peep APPLICATION SPECIFIC ENTRY WIDGETS). obsessed.
-entrylist β this one makes the simplest but also the most universal data entry widget. It lets you enter literally any kind of data, as single line strings. slay:
tepam::argument_dialogbox \
-entry {-label Name -variable Entry}
-textlist β makes a multi line text entry widget β¨ and you pick how tall it is with the-heightattribute:
tepam::argument_dialogbox \
-text {-label Name -variable Text -height 5}
-checkboxlist β a whole group of check boxes, one item, periodt. how many there are and what their option values are? you set that with a list on the-choicesattribute, or through a variable declared with the-choicevariableattribute:
tepam::argument_dialogbox \
-checkbox {-label "Font sytle" -variable FontStyle \
-choices {bold italic underline} -default italic}
If you want the labels on the boxes to be different from the option values, define them with the -choicelabels attribute:
tepam::argument_dialogbox \
-checkbox {-label "Font sytle" -variable FontStyle \
-choices {bold italic underline} \
-choicelabels {Bold Italic Underline} \
-default italic}
And here's the plot twist that separates it from a radio box group: a check box group lets you select several choice options at the same time. which is exactly why the selection gets stored inside the defined variable in the form of a list β even when only one choice option got selected. fr fr, it's always a list.
-radioboxlist β a group of radio boxes. how many, and their option values, come from a list on the-choicesattribute or from a variable declared with the-choicevariableattribute.
Now, in contrast to a check box group, a radio box group lets you select only one choice option at a time. And the selected option value gets stored directly, not in the form of a list, inside the defined variable. periodt.
tepam::argument_dialogbox \
-radiobox {-label "Text adjustment" -variable Adjustment \
-choices {left center right} -default left}
Same deal as before β if the radio box labels should differ from the option values, use -choicelabels:
tepam::argument_dialogbox \
-radiobox {-label "Text adjustment" -variable Adjustment \
-choices {left center right} \
-choicelabels {Left Center Right} -default left}
-checkbuttonlist β this entry widget turns a single choice option on or off. what lands in the variable is either0if the check button wasn't activated, or1if it was. and if you hand it a default value, that default has to be either0or1too. no in-betweens bestie:
tepam::argument_dialogbox \
-checkbutton {-label Capitalize -variable Capitalize -default 1}
There are several types of list and combo boxes available for handling selection lists. π¦
-comboboxlist β the combobox is a glow-up of a normal entry widget paired with a drop-down list box. it lets you pick one single element out of that drop-down list box. the list of available elements can come either as a list on the-choicesattribute, or via a variable named with the-choicevariableattribute:
tepam::argument_dialogbox \
-combobox {-label "Text size" -variable Size -choices {8 9 10 12 15 18} -default 12}
And here's the same energy, but with a variable defining the selection list:
set TextSizes {8 9 10 12 15 18}
tepam::argument_dialogbox \
-combobox {-label "Text size" -variable Size -choicevariable TextSizes -default 12}
-listboxlist β unlike the combo box, the list box is always on display, it never hides. Only one element is selectable β unless the-multiple_selectionattribute is set. You pick the list box height with the-heightattribute, and if you don't explicitly define a height, the list box height automatically adapts itself to the argument dialog box size. π This first example uses a variable to define the available choices:
set set AvailableSizes
for {set k 0} {$k<16} {incr k} {lappend AvailableSizes [expr 1<<$k]}
tepam::argument_dialogbox \
-listbox {-label "Distance" -variable Distance \
-choicevariable AvailableSizes -default 6 -height 5}
Here's a multi-element selection example. And heads up β the default selection can hold multiple elements too:
tepam::argument_dialogbox \
-listbox {-label "Text styles" -variable Styles \
-choices {bold italic underline overstrike} \
-choicelabels {Bold Italic Underline Overstrike} \
-default {bold underline} -multiple_selection 1 \
-height 3}
-disjointlistboxlist β you reach for a disjoint list box instead of a normal list box whenever the order of the selection actually matters. because this entry widget is literally two list boxes: one to select elements, and one to show the selected elements in the order you chose. π
Disjoint listboxes always allow selecting multiple elements. And apart from the -multiple_selection attribute, disjointed list boxes accept the exact same attributes as the normal listbox β think -height, -choices, -choicevariable, -default:
tepam::argument_dialogbox \
-disjointlistbox {-label "Preferred scripting languages" -variable Languages \
-comment "Please select your preferred languages in the order" \
-choices {JavaScript Lisp Lua Octave PHP Perl Python Ruby Scheme Tcl} \
-default {Tcl Perl Python}}
The file and directory selectors are the next group of data entry widgets. πΈ A paragraph over in the section Entry Widget Item Attributes explains the widget specific attributes that let you specify the targeted file types, the active directory, etc. iykyk.
-filelist β this item makes a group of an entry widget plus a button that opens up a file browser. The data typefilegets automatically selected for this entry if no data type was explicitly defined with the-typeattribute:
tepam::argument_dialogbox \
-file {-label "Image file" -variable ImageF \
-filetypes {{"GIF" {*.gif}} {"JPG" {*.jpg}}} \
-initialfile "picture.gif"}
-existingfilelist β this item makes a group of an entry widget plus a button that opens a browser so you can select an existing file. The data typeexistingfilegets automatically selected for this entry if no data type was explicitly defined with the-typeattribute:
tepam::argument_dialogbox \
-existingfile {-label "Image file" -variable ImageF \
-filetypes {{"GIF" {*.gif}} {"JPG" {*.jpg}}} \
-initialfile "picture.gif"}
-directorylist β this item makes a group of an entry widget plus a button that opens a directory browser. The data typedirectorygets automatically selected for this entry if no data type was explicitly defined with the-typeattribute:
tepam::argument_dialogbox \
-directory {-label "Report directory" -variable ReportDir}
-existingdirectorylist β this item makes a group of an entry widget plus a button that opens a browser to select an existing directory. The data typeexistingdirectorygets automatically selected for this entry if no data type was explicitly defined with the-typeattribute:
tepam::argument_dialogbox \
-existingdirectory {-label "Report directory" -variable ReportDir}
And finally, there's one last group of other special data entry widgets. β¨
-colorlist β the color selector is an entry widget plus a button that opens a color browser. The data typecolorgets automatically selected for this entry widget type if no data type was explicitly defined with the-typeattribute:
tepam::argument_dialogbox \
-color {-label "Background color" -variable Color -default red}
-fontlist β the font selector is an entry widget plus a button that opens a font browser. The data typefontgets automatically selected for this entry widget type if no data type was explicitly defined with the-typeattribute. And cute detail: the entry widget shows you an example text rendered in the format of the selected font. π
The font browser lets you select, by default, the font families provided by the font families Tk command, plus a reasonable set of different font sizes between 6 points and 40 points. If you want different sets of font families and font sizes, you specify those with the -font_families or -font_sizes attributes respectively. π
If no default font is provided via the -default attribute, the default font of the label widget to display the selected font will be used as default selected font. β¨ And okay, so β if the font family of this label widget isn't part of the available families, the first available family gets used as the default. And if the font size of this label widget isn't part of the available sizes, the next close available size is selected as the default size. It's giving "we'll find you a fit, bestie." π
tepam::argument_dialogbox \
-font {-label "Font" -variable Font \
-font_sizes {8 10 12 16} \
-default {Arial 20 italic}}
πΈ ENTRY WIDGET ITEM ATTRIBUTES πΈ
All the entry widget items are accepting the following attributes: β like, every single one, no cap. π«Ά
-text stringβ Eventual descriptions and comments specified with the-textattribute are displayed above the entry widget. It's the little note floating over your input box, iconic.
tepam::argument_dialogbox \
-entry {-text "Please enter your name bellow" -variable Name}
-label stringβ the-labelattribute creates, to the left of the entry widget, a label using the provided string as label text. Side-label energy. π
tepam::argument_dialogbox \
-entry {-label Name -variable Name}
-variable stringβ π¨ All entry widgets require a specified variable. After accepting the entered information with the OK button, the entry widget data is stored inside the defined variables. That's the whole point, fr fr.
tepam::argument_dialogbox \
-existingdirectory {-label "Report directory" -variable ReportDir}
-default stringβ eventual default data for the entry widgets can be provided via the-defaultattribute. And here's the plot twist: the default value is overridden if an argument dialog box with a defined context is called another time β the value acknowledged in a previous call will be used in this case as default value. Memory queen. π
tepam::argument_dialogbox \
-checkbox {-label "Font sytle" -variable FontStyle \
-choices {bold italic underline} -default italic}
-optional 0|1β data can be specified as optional or mandatory with the-optionalattribute, which requires either0(mandatory) or1(optional) as attribute data. Choose wisely.
In case an entry is optional and no data has been entered β e.g. the entry contains an empty character string β the entry will be considered as undefined and the assigned variable will not be defined. Not me pointing out that "nothing" is a real answer here. π
tepam::argument_dialogbox \
-entry {-label "City" -variable start_city -type string} \
-entry {-label "Street" -variable start_street -type string -optional 0} \
-entry {-label "Street number" -variable start_street_nbr -type integer -optional 1} \
-type stringβ if the data type is defined with the-typeattribute, the argument dialog box will automatically perform a data type check after acknowledging the entered values and before the dialog box is closed. If a type incompatible value is found, an error message box appears and the user can correct the value. Built-in proofreading, we love to see it. β¨
The argument dialog box accepts all types that have been specified by the TEPAM package and that are also used by tepam::procedure (see the tepam::procedure reference manual). iykyk. π
Some entry widgets β like the file and directory widgets, as well as the color and font widgets β are specifying automatically the default data type if no type has been specified explicitly with the -type attribute. They just know. π
tepam::argument_dialogbox \
-entry {-label "Street number" -variable start_street_nbr -type integer} \
-range stringβ values can be constrained with the-rangeattribute. The valid range is defined with a list containing the minimum valid value and a maximum valid value.
β οΈ The -range attribute has to be used only for numerical arguments, like integers and doubles. Don't try it on your text fields, bestie, it will not slay.
tepam::argument_dialogbox \
-entry {-label Month -variable Month -type integer -range {1 12}}
-validatecommand stringβ custom argument value validations can be performed via specific validation commands that are defined with the-validatecommandattribute. The provided validation command can be a complete script in which the pattern%Pis a placeholder for the argument value that has to be validated. π΅οΈβοΈ
tepam::argument_dialogbox \
-entry {-label "Your comment" -variable YourCom \
-validatecommand "IllegalWordDetector %P"}
While the purpose of this custom argument validation attribute is the validation of a specific argument, there is also a global data validation attribute -validatecommand that allows performing validation that involves multiple arguments. Two flavors, both valid. π
-validatecommand_error_text stringβ this attribute allows overriding the default error message for a custom argument validation (defined by-validatecommand). Make the scolding sound however you want. π
Some other attributes are supported by the list and combo boxes as well as by the radio and check buttons. π
-choices stringβ choice lists can directly be defined with the-choicesattribute. This way to define choice lists is especially adapted for smaller, fixed selection lists. Cute and compact.
tepam::argument_dialogbox \
-listbox {-label "Text styles" -variable Styles \
-choices {bold italic underline} -default underline
-choicelabels stringβ (only check and radio buttons) if the labels of the check and radio boxes should differ from the option values, they can be defined with the-choicelabelsattribute. Show one thing, store another. Main character duality. π
tepam::argument_dialogbox \
-checkbox {-label "Font sytle" -variable FontStyle \
-choices {bold italic underline} \
-choicelabels {Bold Italic Underline}
-choicevariable stringβ another way to define the choice lists is using the-choicevariableattribute. This way to define choice lists is especially adapted for huge and eventually variable selection lists. Big list energy only. π¦
set TextSizes {8 9 10 12 15 18}
tepam::argument_dialogbox \
-combobox {-label "Text size" -variable Size -choicevariable TextSizes}
-multiple_selection 0|1β the list box item (-listbox) allows by default selecting only one list element. By setting the-multiple_selectionattribute to1, multiple elements can be selected. Pick 'em all, greedy girl. π
tepam::argument_dialogbox \
-listbox {-label "Text styles" -variable Styles \
-choices {bold italic underline} -default underline \
-multiple_selection 1 -height 3}
Some additional attributes are supported by the file and directory selection widgets. π
-filetypes stringβ the file type attribute is used by the-fileand-existingfileitems to define the file endings that are searched by the file browser.
tepam::argument_dialogbox \
-file {-label "Image file" -variable ImageF \
-filetypes {{"GIF" {*.gif}} {"JPG" {*.jpg}}}}
-initialfile stringβ the initial file used by the file browsers of the-fileand-existingfilewidgets is by default the file defined with the-defaultattribute, unless a file is specified with the-initialfileattribute. Override privileges, unlocked. π
tepam::argument_dialogbox \
-file {-variable ImageF -initialfile "picture.gif"}
-activedir stringβ the-activedirattribute will override the default active search directory used by the file browsers of all file and directory entry widgets. The default active search directory is defined by the directory of a specified initial file (-initialfile) if defined, and otherwise by the directory of the default file/directory, specified with the-defaultattribute. So it's a whole chain of "well, actually, ifβ¦" and we respect it. π
tepam::argument_dialogbox \
-file "-variable ImageF -activedir $pwd"
Finally, there is a last attribute supported by some widgets: β
-height stringβ all widgets containing a selection list (-listbox,-disjointlistbox,-font) as well as the multi line-textwidget are accepting the-heightattribute, which defines the number of displayed rows of the selection lists. Rows on rows. π
tepam::argument_dialogbox \
-listbox {-label "Text size" -variable Size \
-choices {8 9 10 12 15 18} -default 12 -height 3}
If no height has been explicitly specified, the height of the widget will be dynamically adapted to the argument dialog box size. It just fits itself, no notes. β¨
β¨ APPLICATION SPECIFIC ENTRY WIDGETS β¨
okay so bestie, you can totally make your own custom entry widget for the argument dialog box by adding a dedicated procedure to the tepam namespace. π
This procedure has three arguments; the first one is the widget path, the second one a subcommand and the third argument has various purposes:
proc tepam::ad_form(<WidgetName>) {W Command {Par ""}} {
upvar Option Option; # if required
variable argument_dialogbox; # if required
switch $Command {
"create" <CreateCommandSequence>
"set_choice" <SetChoiceCommandSequence>
"set" <SetCommandv>
"get" <GetCommandSequence>
}
}
Argument_dialogbox takes care about the -label and -text attributes for all entry widgets. For any data entry widget it creates a frame into which the data entry widget components can be placed. The path to this frame is provided via the W argument. π«Ά
The entry widget procedure has to support 3 mandatory and an optional command that are selected via the argument Command:
createβ The entry widget is called a first time with the commandcreateto build the data entry widget. The frames that are made available byargument_dialogboxfor the entry widgets are by default only extendable in the X direction. To make them also extendable in the Y direction, for example for extendable list boxes, the commandad_form(make_expandable) $Whas to be executed when an entry widget is built. πset_choiceβ The entry widget procedure is only called with theset_choicecommand if the-choicesor-choicevariablehas been specified. The command is therefore only relevant for list and combo boxes. The available selection list that is either specified with the-choicesor-choicevariableattribute is provided via theParargument to the entry widget procedure. This list can be used to initialize an available choice list. β¨setβ If a default value is either defined via the-defaultattribute or via a preceding call the entry widget procedure is called with thesetcommand. The argumentParcontains in this case the value to which the entry widget has to be initialized. πgetβ The entry widget procedure commandgethas to return the current value of the entry widget. Periodt. π₯
Eventually specified entry widget item attributes are available via the Option array variable of the calling procedure. This variable becomes accessible inside the entry widget procedure via the upvar command. π
There may be a need to store some information in a variable. The array variable argument_dialogbox has to be used for this purpose together with array indexes starting with "$W,", e.g. argument_dialogbox($W,values). πΎ
Examples of entry widget procedures are directly provided by the TEPAM package source file that specifies the standard entry widget procedures. The simplest procedure is the one for the basic entry widget:
proc tepam::ad_form(entry) {W Command {Par ""}} {
switch $Command {
"create" {pack [entry \$W.entry] -fill x \
-expand yes -pady 4 -side left}
"set" {\$W.entry insert 0 $Par}
"get" {return [\$W.entry get]}
}
}
It is also possible to relay on an existing entry widget procedure to derive a new, more specific one. The radiobox widget is used for example, to create a new entry widget that allows selecting either left, center or right. The original radiobox widget is called with the set_choice command immediately after the create command, to define the fixed list of selection options. π
proc tepam::ad_form(rcl) {W Command {Par ""}} {
set Res [ad_form(radiobox) $W $Command $Par]
if {$Command=="create"} {
ad_form(radiobox) $W set_choice {left center right}
}
return $Res
}
Please consult the TEPAM package source file to find additional and more complex examples of entry widget procedures. π§
πΎ VARIABLES πΎ
The argument_dialogbox is using two variables inside the namespace ::tepam:
argument_dialogboxβ Application specific entry widget procedures can use this array variable to store their own data, using as index the widget path provided to the procedure, e.g.argument_dialogbox($W,<sub_index>). πlast_parametersβ This array variable is only used by an argument dialog box if its context has been specified via the-contextattribute. The argument dialog box position and size as well as its entered data are stored inside this variable if the data are acknowledged and the form is closed. This allows the form to restore its previous state once it is called another time. To reuse the saved parameters not just in the actual application session but also in another one, it is sufficient to store thelast_parameterarray variable contents in a configuration file which is loaded the next time an application is launched. π
π SEE ALSO π
tepam(3tcl)tepam::procedure(3tcl)
π KEYWORDS π
data entry form, parameter entry form
π CATEGORY π
Argument entry form, mega widget
Β©οΈ COPYRIGHT Β©οΈ
Copyright (c) 2009-2013, Andreas Drollinger
that's the whole vibe, bestie π this was tcllib 0.5.0, page tep...gbox(3tcl). no cap, you're gonna slay with these custom widgets. β¨π
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- Copyright (c) 2009-2013, Andreas Drollinger
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms