hwtk::selectlist
Creates a SelectList object.
Format
hwtk::selectlist - pathName ?option value? …
Standard Options
- -clientdata
- Database name: clientData
- -height
- Database name: height
- -helpcommand
- Database name: helpcommand
- -relief
- Database name: relief
- -width
- Database name: width
Widget Specific Options
- -backgroundimage
- Database name: backgroundImage
- -closeeditor
- Database name: closeeditor
- -itemactivecommand
- Database name: itemactivecommand
- -listener
- Database name: listener
- -menu
- Database name: menu
- -selectcommand
- Database name: selectcommand
- -selectionindicator
- Database name: selectionindicator
- -selectmode
- Database name: selectmode
- -showheadermenu
- Database name: showheadermenu
- -statusbar
- Database name: statusbar
- -stripes
- Database name: stripes
Widget Commands
- pathName cget option
- Returns the current value of the configuration option given by option.
- pathName columnadd columnDesc ?arg arg …?
- This command is similar to the configure widget command except that it
modifies options associated with the columns specified by the
columDesc (tag).
- -visible
- Boolean
- -sort
- Boolean
- -text
- Column header
- -image
- Column header image
- -itemjustify
- Justify the items in the column (defaults to left)
- -justify
- Justify column title (default left)
- -expand
- Boolean
- -width
- Width of column
- -headermenu
- Context menu for RMB on column header
- pathName columncget columnDesc option
- Returns configuration value for a column tag and option.
- pathName columndelete columnDesc
- Delete column form the widget. all will delete all columns.
- pathName columnexists columnDesc
- Returns true if the column already exists in the widget; false otherwise.
- pathName columnlist
- Returns list of columns in the widget.
- pathName configure ?option? ?value option value …?
- Query or modify the configuration options of the widget. 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. If option is specified with no value, then the command returns a list describing the named option: the elements of the list are the option name, database name, database class, default value, and current value. If no option is specified, returns a list describing all of the available options for pathName.
- pathName fittocontent
- Size the selectlist to show all content.
- pathName identify element x y
- Returns the name of the element under the point given by x and y, or an empty string if the point does not lie within any element. x and y are pixel coordinates relative to the widget. Some widgets accept other identify subcommands.
- pathName instate statespec ?script?
- Test the widget’s state. If script is not specified, returns 1 if the
widget state matches statespec and 0 otherwise. If script is specified,
equivalent to
if{[pathNameinstatestateSpec]}script
- pathName reqheight
- Return the height required by the widget. More accurate than winfo reqheight.
- pathName reqwidth
- Return the width required by the widget. More accurate than winfo reqwidth.
- pathName rowadd tag ?arg arg …?
- Add new row in select list widget. For example, pathName rowadd tag value tag1 value1 will add two items to the selectlist with the tags tag tag1.
- pathName rowcget rowDesc option
- Returns the value for a given configuration option.
- pathName rowconfigure rowDesc ?arg arg …?
- Configures the row given by rowDesc. Valid options are -values, -background or -foreground. Arguments for -values must be given in the form of “[list column1 value1 column2 value2 …]”.
- pathName rowdelete rowDesc ?arg arg …?
- Deletes the given row tag from the widget. all deletes all the rows from the widget
- pathName rowexists item
- Returns a 1 if the given tag exists in the widget, 0 otherwise.
- pathName rowlist
- Returns list of item tags exists in the widget.
- pathName see itemDesc
- Updates the SelectList widget so that the item specified by itemDesc is visible. If the item is already visible in the list, this command has no effect; otherwise, the widget will scroll appropriately.
- pathName selectionadd itemDesc
- Adds the given tag to the selection in the widget and the selection command will be executed.
- pathName selectionclear ?arg arg …?
- Deselects the given tag from the selection. If all supplied all the items will be deselected
- pathName selectionget ?arg arg …?
- Returns the list of items which are in the selection.
- pathName selectioninverse
- Reverses the selection in the widget.
- pathName setactive item
- Sets item to the active state, same as if it was clicked.
- pathName state ?stateSpec?
- Modify or inquire widget state. If stateSpec is
present, sets the widget state: for each flag in
stateSpec, sets the corresponding flag or clears it
if prefixed by an exclamation point. Returns a new state spec indicating
which flags were changed:
will restore pathName to the original state. If stateSpec is not specified, returns a list of the currently-enabled state flags.setchanges[pathNamestatespec]
pathNamestate$changes
- pathName typelist
- Displays a list of available editor types.
Example
set w [::hwtk::dialog .dialog -title "selectlist demo"]
$w hide apply;
set recess [$w recess]
namespace eval ::texample {};
proc ::texample::OnSelect {W S c} {
{puts [info level 0]
}
hwtk::selectlist $recess.s1 -stripes 1 -selectmode multiple -selectcommand "::texample::OnSelect %W %S %c"
pack $recess.s1 -fill both -expand true;
$recess.s1 columnadd entities -text Entities
$recess.s1 columnadd id -text Id
$recess.s1 columnadd color -image palette-16.png
$recess.s1 columnadd thickness -text Thickness
for {set i 0} {$i < 100} {incr i} {
set clr [expr {int(rand()*64)}]
$recess.s1 rowadd row$i -values [list entities "comp $clr" id $i color [expr {$clr ? $clr : 1}] thickness $i.$i$i]
{
$w post