hwtk::listbox
Create and manipulate listbox widgets.
Format
hwtk::listbox - pathName ?option value? …
Description
Creates and manipulates a listbox widget.
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
 - -headermenu
 - Database name: headermenu
 - -headertext
 - Database name: headertext
 - -listener
 - Database name: listener
 - -menu
 - Database name: menu
 - -selectcommand
 - Database name: selectcommand
 - -selectindicator
 - Database name: selectindicator
 - -selectmode
 - Database name: selectmode
 - -showheader
 - Database name: showHeader
 - -sort
 - Database name: sort
 - -stripes
 - Database name: stripes
 - -unique
 - Database name: unique
 - -wrap
 - Database name: wrap
 
Widget Commands
- pathName add tag ?value? *...?
 - This command creates items in the listbox. The arguments should be pair of item tag and its display value.
 - pathName cget option
 - Returns the current value of the configuration option given by option.
 - 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 delete ?tags?
 - Deletes the listbox items specified by tag. all tag deletes all the items in the listbox.
 - pathName exists ?tag?
 - Returns 1 if the specified item exists, and 0 if not.
 - pathName get ?arg arg ...?
 - Returns listbox content (only text for all items).
 - 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 index tag
 - Returns the index (item order) for a given tag.
 - pathName insert pos tag value
 - Inserts the new item at a given position. Position is decimal value and it is item order.
 - 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 itemcget item option
 - To get the configuration properties of a item.
 - pathName itemconfigure item ?arg arg …?
 - If no option is specified, returns a list describing all of the
                            available options for the item given by tag. If option is specified with
                            no value, then the command returns a list describing the one named
                            option. If one or more option-value pairs are specified, then the
                            command modifies the given item option(s) to have the given value(s); in
                            this case the command returns an empty string.
- -text
 - displaytext
 - -image
 - display image
 
 - pathName move scrItem tarItem
 - Move the given item to the target position.
 - pathName position tag
 - Returns the position in the listbox of the given tag.
 - pathName see itemDesc
 - Updates the listbox so that the item specified by itemDesc is visible. If the item is already visible in the listbox, this command has no effect; if the item is not visible, the listbox will scroll appropriately.
 - pathName selection command ?arg arg ...?
 - This command is used to adjust the selection within a treectrl. It has
                            several forms, depending on option:
- pathName selection add tag
 - Adds the given tag to the selection in the widget and the selection command will be executed.
 - pathName selection clear tag
 - Deselects the given tag from the selection. If all supplied all the items will be deselected.
 - pathName selection get
 - Returns the list of items which are in the selection.
 
 - 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
::hwtk::dialog .dlg -title "::hwtk::listbox"
set recess [.dlg recess] 
set lstbox [::hwtk::listbox $recess.lb -headertext "Header text"]
pack $1stBox -fill both -expand true;
set i 0;
foreach f [glob -nocomplain -types {d f} -directory [pwd] *] {
    $1stBox add files$i "[file tail $f]"
    set image "file-16.png"
    if {[file isdirectory $f]} {
        set image "folder-16.png"
    }
    $1stBox itemconfigure file$i -image $image
    incr i;
}
.dlg post