|
Disjointlistbox
The disjointlistbox iwidget provides the user with 2 scrolledlistboxes, that allows the user to pass items from one listbox to the other. This is commonly used when the user needs to select multiple items that are a subset of another list. The listbox buttons can be placed between or below the listboxes. Each listbox has a running count of the number of items within its listbox. Their are various methods that work on each of the listboxes, and most methods come in pairs that operate on one listbox and are distinguished by lhs or rhs, denoting left hand side and right hand side respectively. Hence, to access one of the listboxes, the user would append lhs or rhs, depending on the side. So, an insert operation would become insertlhs and insertrhs. There is also a more generic method that allows access to the scrolledlistbox methods using lhs and rhs methods. Using these methods, the user can access directly each scrolledlistbox. When the user clicks in either listbox, then the button associated with the other listbox with become inactive.
For further information, see the Disjointlistbox
manpage
Components: hull lhs lhsbutton lhsCount rhs rhsbutton rhsCount
|
wm title . "Disjointlistbox Example"
##=========================================================
## Create a disjointlistbox iwidget
##=========================================================
##
iwidgets::disjointlistbox .dj \
-buttonplacement center \
-lhslabeltext "Grocery Items" \
-rhslabeltext "Grocery List" \
-lhsbuttonlabel "Add Grocery Item" \
-rhsbuttonlabel "Remove Grocery Item"
pack .dj \
-fill both \
-expand true
##
## Populate both fields, using 2 different methods
##
.dj setlhs [list bananas apples juice milk bread eggs beer]
.dj insertrhs [list fish salsa]
##
## Make an initial selection in the
## lhs listbox
##
.dj lhs selection set 2 3
|
Download this sample code |
|