Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | |
2 | =head1 NAME | |
3 | ||
4 | Tk::BrowseEntry - entry widget with popup choices. | |
5 | ||
6 | =for pm Tixish/BrowseEntry.pm | |
7 | ||
8 | =for category Tix Extensions | |
9 | ||
10 | =head1 SYNOPSIS | |
11 | ||
12 | use Tk::BrowseEntry; | |
13 | ||
14 | $b = $frame->BrowseEntry(-label => "Label", -variable => \$var); | |
15 | $b->insert("end", "opt1"); | |
16 | $b->insert("end", "opt2"); | |
17 | $b->insert("end", "opt3"); | |
18 | ... | |
19 | $b->pack; | |
20 | ||
21 | =head1 DESCRIPTION | |
22 | ||
23 | BrowseEntry is a poor man's ComboBox. It may be considered an | |
24 | enhanced version of LabEntry which provides a button to popup the | |
25 | choices of the possible values that the Entry may | |
26 | take. BrowseEntry supports all the options LabEntry supports | |
27 | except B<-textvariable>. This is replaced by B<-variable>. Other | |
28 | options that BrowseEntry supports. | |
29 | ||
30 | =over 4 | |
31 | ||
32 | =item B<-listwidth> | |
33 | ||
34 | Specifies the width of the popup listbox. | |
35 | ||
36 | =item B<-variable> | |
37 | ||
38 | Specifies the variable in which the entered value is to be stored. | |
39 | ||
40 | =item B<-browsecmd> | |
41 | ||
42 | Specifies a function to call when a selection is made in the | |
43 | popped up listbox. It is passed the widget and the text of the | |
44 | entry selected. This function is called after the entry variable | |
45 | has been assigned the value. | |
46 | ||
47 | =item B<-listcmd> | |
48 | ||
49 | Specifies the function to call when the button next to the entry | |
50 | is pressed to popup the choices in the listbox. This is called before | |
51 | popping up the listbox, so can be used to populate the entries in | |
52 | the listbox. | |
53 | ||
54 | =item B<-arrowimage> | |
55 | ||
56 | Specifies the image to be used in the arrow button beside the entry | |
57 | widget. The default is an downward arrow image in the file cbxarrow.xbm | |
58 | ||
59 | =item B<-choices> | |
60 | ||
61 | Specifies the list of choices to pop up. This is a reference to an | |
62 | array of strings specifying the choices. | |
63 | ||
64 | =item B<-state> | |
65 | ||
66 | Specifies one of three states for the widget: normal, readonly, or | |
67 | disabled. If the widget is disabled then the value may not be changed | |
68 | and the arrow button won't activate. If the widget is readonly, the | |
69 | entry may not be edited, but it may be changed by choosing a value | |
70 | from the popup listbox. normal is the default. | |
71 | ||
72 | =back | |
73 | ||
74 | =head1 METHODS | |
75 | ||
76 | =over 4 | |
77 | ||
78 | =item B<insert(>I<index>, I<string>B<)> | |
79 | ||
80 | Inserts the text of I<string> at the specified I<index>. This string | |
81 | then becomes available as one of the choices. | |
82 | ||
83 | =item B<delete(>I<index1>, I<index2>B<)> | |
84 | ||
85 | Deletes items from I<index1> to I<index2>. | |
86 | ||
87 | =back | |
88 | ||
89 | =head1 BUGS | |
90 | ||
91 | BrowseEntry should really provide more of the ComboBox options. | |
92 | ||
93 | =head1 AUTHOR | |
94 | ||
95 | B<Rajappa Iyer> rsi@earthling.net | |
96 | ||
97 | B<Chris Dean> ctdean@cogit.com made additions. | |
98 | ||
99 | This code was inspired by ComboBox.tcl in Tix4.0 by Ioi Lam and | |
100 | bears more than a passing resemblance to ComboBox code. This may | |
101 | be distributed under the same conditions as Perl. | |
102 | ||
103 | =cut | |
104 |