widget_listsimple(n)
Hey bestie! You're reading the widget_listsimple(n) page, aka the full scoop on the widget::listsimple widget. π This is a Tcl/Tk megawidget situation, and we are keeping every single detail β every flag, callback, caveat, and weird little corner. No skipping, no cap. β¨
πΈ NAME πΈ
widget::listsimple β yep, it's the widget::listsimple widget, bestie. That's the name and that's the vibe. π
π¦ SYNOPSIS π¦
package require Tcl 8.5
package require Tk 8.5
package require widget::listsimple ?0.1.2?
package require widget::validator ?0.1?
package require widget::scrolledwindow
package require snit
package require tooltip
package require img::png
package require msgcat
widget::listsimple pathname ?options?
widgetCmd destroy
widgetCmd configure
widgetCmd configure option value ...
widgetCmd configure option
widgetCmd cget option
{*}cmdprefix get
{*}cmdprefix set values
{*}cmdprefix text errvar
π DESCRIPTION π
This package gives you a megawidget for the interactive entry of unordered lists. For a megawidget that allows entry of ordered lists, and more, please see the package widget::listentry. π«Ά
π CLASS API π
The widget class supports a single command, for the creation of widgets. One command, main character energy only. β¨
widget::listsimple pathname ?options?β this command creates and configures new instances of the widget. For details on the available options, peep the Widget Options section. The result of the command is thepathnameof the new widget.
π INSTANCE API π
All widget instances support the following methods, bestie. π
widgetCmd destroyβ destroys the widget. Any further access to the widget will generate errors. The result of the command is the empty string.widgetCmd configureβ this method comes in three variants. This variant returns a list containing the current configuration of the widget, i.e. the values for all options. For details on the available options, see the Widget Options section.widgetCmd configure option value ...β this method comes in three variants. This variant reconfigures the widget, setting the specified options to the given values. Note that it is not possible to change the construction-time only options. For details on the available options, see the Widget General Options section. The result of the command is the empty string.widgetCmd configure optionβ this method comes in three variants. This variant is an alias for the methodcgetbelow and is identical to it.widgetCmd cget optionβ returns the current value of the specified option. For details on the available options, see the Widget Options section.
π WIDGET OPTIONS π
This section explains all the options available to instances of widget::listsimple. Please note that a few of the options can be set only at instance construction time. The majority of the options can however be set both during construction and runtime. π
π οΈ WIDGET CONSTRUCTION-TIME ONLY OPTIONS π οΈ
-values cmdprefixβ specifies a callback for the management of a predefined list of strings a user may enter. If specified, the widget will use a combobox instead of a plain entry field and fill its list during widget construction using the data delivered by this callback. The callback will be further invoked whenever a new value is entered into the main list, to save the extended list of predefined values.
The signature of this callback is:
{*}cmdprefix getβ in this form the callback is expected to return a list of strings. The strings are loaded into the list of the internal combobox for quick access by the user. It will be invoked once, during widget construction, to load the list of predefined strings a user may enter.{*}cmdprefix set valuesβ in this form the callback is given a list of new strings and expected to save them somewhere for future use. The return value of the callback is ignored. This form is invoked whenever the user entered a new string into the main list. The order of strings invaluesrepresents the order used to show them in the combobox's list.
-validate cmdprefixβ specifies a callback which is invoked after every change of the contents of the internal entry field. The signature of this callback is:
{*}cmdprefix text errvar
where text is the string to validate, and errvar the name of a variable the callback can store an error message into when it detects invalid data. The system expects that the callback returns a boolean value, where true indicates that text is valid.
The default validation, when no callback was specified, will treat the empty string as invalid, and everything else as valid.
Please note that the widget will prevent the entry of duplicate values into the main list, regardless of the validity of the input otherwise. This is in keeping with that this widget is meant for the entry of unordered lists, essentially a set of strings. π«Ά
π WIDGET GENERAL OPTIONS π
-listvariable varnameβ specifies the variable holding the list to be manipulated by the widget. Any changes to the list outside of the widget are automatically imported into the widget. Similarly, all changes made to the list by the widget are automatically exported to this variable.-skin-add stringβ string skin option for the labels shown.-skin-remove stringβ string skin option for the labels shown.-skin-tip-add stringβ tooltip string skin option.-skin-tip-remove stringβ tooltip string skin option.-skin-tip-main stringβ tooltip string skin option.-skin-tip-entry stringβ tooltip string skin option.-skin-tip-list stringβ tooltip string skin option.-skin-tip-empty stringβ tooltip string skin option.-skin-tip-duplicate stringβ tooltip string skin option.-skin-tip-add-none stringβ tooltip string skin option.-skin-tip-remove-none stringβ tooltip string skin option.-skin-img-add imageβ image skin option.-skin-img-remove imageβ image skin option.-skin-invalid-color colorβ color skin option. This one defaults toyellow.
Okay so all of these options modify the appearance of the widget, i.e. its skin. All options taking a string argument influence the various labels shown, with the -skin-tip-* options influencing the tooltips shown on hovering over the various parts in particular. All the strings are run through msgcat first, enabling text localization through message catalogs. The default values are keys into the message catalogs which are part of the package itself. π
The options taking images modify the images shown on the buttons for adding and removing elements of the list. They default to the PNG images distributed with the package itself. πΌοΈ
The single option taking a color value modifies the color used to highlight invalid data entered into the internal entry field of the widget. This option defaults to yellow. π
π EXAMPLE π
The original page has this section heading but no example text underneath, so there's literally nothing to show here β keeping it 100% faithful, bestie. π
π BUGS, IDEAS, FEEDBACK π
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category widget::listsimple of the Tklib Trackers http://core.tcl.tk/tklib/reportlist. Please also report any ideas for enhancements you may have for either package and/or documentation. π
π KEYWORDS π
- data entry lists
- data entry set of strings
- data entry unordered list
- list entry panel
- set entry panel
- widget
Source/version/date tea at the very end: this is from tklib, version 0.1.2, for widget_listsimple(n). The original footer doesn't give a separate date, so we're not inventing one β mwah, bestie. πβ¨
π¦ where this page comes from
- alpine 3.24: tk-lib-doc 0.7-r0 Β· TCL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms