hwtk::selectlist
Creates a SelectList object.
hwtk::selectlist - pathName ?option value? ...
-clientdata, clientData, ClientData
-helpcommand, helpcommand, Command
Command-Line Name: -backgroundimage
Database Name: backgroundImage
Database Class: BackgroundImage
Specifies the name of an image to draw as the list background.
Command-Line Name: -closeeditor
Database Name: closeeditor
Database Class: Closeeditor
Boolean option when set to true, the editor unposts upon successful set value. Default is set to false.
Command-Line Name: -itemactivecommand
Database Name: itemactivecommand
Database Class: Command
Tcl script that will be executed when the item is activated.
Command-Line Name: -listener
Database Name: listener
Database Class: ActionListener
Action listener object. User can derive hwtk::interface::HWTreectrllistener and create class where user can overwrite the methods for all actions (events like Selection, ButtonPress, KeyPress, and so on).
Command-Line Name: -menu
Database Name: menu
Database Class: Menu
Context menu posted for RMB (Right Mouse Button) on Listbox.
Command-Line Name: -selectcommand
Database Name: selectcommand
Database Class: Command
Tcl script executed on selection in the Listbox.
%-char substitutions are:
• | %W widget path |
• | %S selected items |
• | %c count (number of items selected) |
Command-Line Name: -selectindicator
Database Name: selectindicator
Database Class: SelectIndicator
Checkbutton will be displayed against each item in the Listbox. User can select item by clicking on checkbutton. This can be configured as auto, show, or hide; defaults to hide
Command-Line Name: -selectmode
Database Name: selectmode
Database Class: SelectMode
Specifies one of several styles for manipulating the selection. The value of the option may be arbitrary, but the default bindings expect it to be either single, or multiple. The default value is multiple.
Command-Line Name: -statusbar
Database Name: statusbar
Database Class: Statusbar
Specifies a boolean value that determines whether this widget should display status bar or not; defaults to true.
Command-Line Name: -stripes
Database Name: stripes
Database Class: Stripes
Specifies the boolean value that determines whether this widget should draw background stripes; defaults to true.
In addition to the standard configure, cget, identify, instate, and state commands, selectlist support the following additional widget commands:
pathName columnadd columnDesc ?arg arg ...?
This command creates a new column in the selectlist widget. The new column is placed to the right of all other columns (except the tail column). Any option-value arguments configure the new column according to the columnconfigure command. The return value is the unique identifier of the new column.
pathName columnconfigure columnDesc ?option value ...?
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 (defaults to true)
-sort boolean (defaults to true)
-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 (default true)
-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 columndelete all
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 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 rowdelete rowDesc ?arg arg ...?
Deletes the given row tag from the widget. all deletes all the rows from the widget pathName rowdelete all
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.
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.sl -stripes 1 -selectmode multiple -selectcommand "::texample::OnSelect %W %S %c"
pack $recess.sl -fill both -expand true;
$recess.sl columnadd entities -text Entities
$recess.sl columnadd id -text Id
$recess.sl columnadd color -image palette-16.png
$recess.sl columnadd thickness -text Thickness
for {set i 0} {$i < 100} {incr i} {
set clr [expr {int(rand()*64)}]
$recess.sl rowadd row$i -values [list entities "comp $clr" id $i color [expr {$clr ? $clr : 1}] thickness $i.$i$i]
}
$w post