hwtk::listbox - Create and manipulate listbox widgets.
Creates and manipulates a listbox widget.
hwtk::listbox - 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: -headermenu
Database Name: headermenu
Database Class: Menu
Column specific header contex menu.
Command-Line Name: -headertext
Database Name: headertext
Database Class: Text
Specifies a text string to be displayed as the title.
Command-Line Name: -listener
Database Name: listener
Database Class: ActionListener
Action listener object. User can derive hwtk::interface::HWTreectrllistener and create class where you can overwrite the methods for all actions, such as 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 selction 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 agains 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: -showheader
Database Name: showHeader
Database Class: ShowHeader
Specifies a boolean value that determines whether this widget should display the header line with the headertext at the top of the widget. The default value is true.
Command-Line Name: -sort
Database Name: sort
Database Class: Sort
Specifies the boolean value that determines whether this widget should sort the items in the list; 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 for this widget; defaults to true.
Command-Line Name: -unique
Database Name: unique
Database Class: Unique
Specifies the boolean value that determines whether this widget should have all unique items or not.
Command-Line Name: -wrap
Database Name: wrap
Database Class: Wrap
Specifies whether items are arranged in a 1- or 2-dimensional layout. It accepts window or “”; defaults to “”.
In addition to the standard configure, cget, identify, instate, and state commands, listbox support the following additional widget commands:
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