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
42 the listvariable for the right side listbox. This flag
43 will also cause the -title and -geometry flags to be
44 ignored.
45
46 -reorder
47 boolean specifying if buttons allowing the user to change
48 the order of the right listbox should appear or not.
49 defaults to true
50
51 -title sets the title of the dialog window. defaults to "Config‐
52 uration"
53
54 -llabel
55 sets the heading above the left list. defaults to "Avail‐
56 able:"
57
58 -rlabel
59 sets the heading above the right list. defaults to
60 "Selected:"
61
62 -lbuttontext
63 sets the text on the "move left" button. defaults to "<<"
64
65 -rbuttontext
66 sets the text on the "move right" button. defaults to
67 ">>"
68
69 -ubuttontext
70 sets the text on the "move up" button. defaults to "Move
71 Up"
72
73 -dbuttontext
74 sets the text on the "move down" button. defaults to
75 "Move Down"
76
77 -geometry
78 sets the geometry of the dialog window.
79
81 package require swaplist
82 namespace import swaplist::*
83
84 if {[swaplist .slist opts "1 2 3 4 5 6 7 8 9" "1 3 5"]} {
85 puts "user chose numbers: $ops"
86 }
87
88
89
91 dialog, disjointlistbox, listbox
92
93
94
95swaplist 0.1 swaplist(n)