1swaplist(An)dialog which allows a user to move options between two lisstwsaplist(n)
2
3
4
5______________________________________________________________________________
6
8 swaplist - A dialog which allows a user to move options between two
9 lists
10
12 package require Tcl 8.4
13
14 package require Tk 8.4
15
16 package require swaplist ?0.1?
17
18 ::swaplist::swaplist pathName variable completeList selectedList
19 ?options?
20
21_________________________________________________________________
22
24 This package provides a dialog which consists of 2 listboxes, along
25 with buttons to move items between them and reorder the right list.
26
27 ::swaplist::swaplist pathName variable completeList selectedList
28 ?options?
29 Creates a dialog which presents the user with a pair of list‐
30 boxes. Items are selected by using the buttons to move them to
31 the right list. The contents of the right list are put in the
32 variable upon closure of the dialog. The command returns a
33 boolean indicating if the user pressed OK or not. If -geometry
34 is not specified, the dialog is centered in its parent toplevel
35 unless its parent is . in which case the dialog is centered in
36 the screen.
37
38 Options:
39
40 -embed if this flag is supplied, the procedure will create a
41 swaplist widget named pathName, with the variable set as the
42 listvariable for the right side listbox. This flag will
43 also cause the -title and -geometry flags to be ignored.
44
45 -reorder boolean specifying if buttons allowing the user to
46 change the order of the right listbox should appear or not.
47 defaults to true
48
49 -title sets the title of the dialog window. defaults to "Config‐
50 uration"
51
52 -llabel sets the heading above the left list. defaults to
53 "Available:"
54
55 -rlabel sets the heading above the right list. defaults to
56 "Selected:"
57
58 -lbuttontext sets the text on the "move left" button. defaults
59 to "<<"
60
61 -rbuttontext sets the text on the "move right" button. defaults
62 to ">>"
63
64 -ubuttontext sets the text on the "move up" button. defaults to
65 "Move Up"
66
67 -dbuttontext sets the text on the "move down" button. defaults
68 to "Move Down"
69
70 -geometry sets the geometry of the dialog window. screen.
71
73 package require swaplist
74 namespace import swaplist::*
75
76 if {[swaplist .slist opts "1 2 3 4 5 6 7 8 9" "1 3 5"]} {
77 puts "user chose numbers: $ops"
78 }
79
80
81
83 dialog, disjointlistbox, listbox
84
85
86
87swaplist 0.1 swaplist(n)