]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxChoice}}\label{wxchoice} |
2 | ||
3 | A choice item is used to select one of a list of strings. Unlike a | |
4 | listbox, only the selection is visible until the user pulls down the | |
5 | menu of choices. | |
6 | ||
7 | \wxheading{Derived from} | |
8 | ||
bed5584e | 9 | \helpref{wxControlWithItems}{wxcontrolwithitems}\\ |
a660d684 KB |
10 | \helpref{wxControl}{wxcontrol}\\ |
11 | \helpref{wxWindow}{wxwindow}\\ | |
12 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
13 | \helpref{wxObject}{wxobject} | |
14 | ||
954b8ae6 JS |
15 | \wxheading{Include files} |
16 | ||
17 | <wx/choice.h> | |
18 | ||
a660d684 KB |
19 | \wxheading{Window styles} |
20 | ||
21 | There are no special styles for wxChoice. | |
22 | ||
23 | See also \helpref{window styles overview}{windowstyles}. | |
24 | ||
5de76427 JS |
25 | \wxheading{Event handling} |
26 | ||
27 | \twocolwidtha{7cm} | |
28 | \begin{twocollist}\itemsep=0pt | |
29 | \twocolitem{{\bf EVT\_CHOICE(id, func)}}{Process a wxEVT\_COMMAND\_CHOICE\_SELECTED event, | |
30 | when an item on the list is selected.} | |
31 | \end{twocollist} | |
32 | ||
a660d684 KB |
33 | \wxheading{See also} |
34 | ||
5de76427 JS |
35 | \helpref{wxListBox}{wxlistbox}, \helpref{wxComboBox}{wxcombobox}, |
36 | \rtfsp\helpref{wxCommandEvent}{wxcommandevent} | |
a660d684 KB |
37 | |
38 | \latexignore{\rtfignore{\wxheading{Members}}} | |
39 | ||
40 | \membersection{wxChoice::wxChoice}\label{wxchoiceconstr} | |
41 | ||
42 | \func{}{wxChoice}{\void} | |
43 | ||
44 | Default constructor. | |
45 | ||
eaaa6a06 | 46 | \func{}{wxChoice}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 | 47 | \param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp |
eaaa6a06 JS |
48 | \param{int}{ n}, \param{const wxString }{choices[]},\rtfsp |
49 | \param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``choice"}} | |
a660d684 KB |
50 | |
51 | Constructor, creating and showing a choice. | |
52 | ||
53 | \wxheading{Parameters} | |
54 | ||
55 | \docparam{parent}{Parent window. Must not be NULL.} | |
56 | ||
57 | \docparam{id}{Window identifier. A value of -1 indicates a default value.} | |
58 | ||
59 | \docparam{pos}{Window position.} | |
60 | ||
61 | \docparam{size}{Window size. If the default size (-1, -1) is specified then the choice is sized | |
62 | appropriately.} | |
63 | ||
64 | \docparam{n}{Number of strings with which to initialise the choice control.} | |
65 | ||
66 | \docparam{choices}{An array of strings with which to initialise the choice control.} | |
67 | ||
68 | \docparam{style}{Window style. See \helpref{wxChoice}{wxchoice}.} | |
69 | ||
70 | \docparam{validator}{Window validator.} | |
71 | ||
72 | \docparam{name}{Window name.} | |
73 | ||
74 | \wxheading{See also} | |
75 | ||
76 | \helpref{wxChoice::Create}{wxchoicecreate}, \helpref{wxValidator}{wxvalidator} | |
77 | ||
c9110876 VS |
78 | \pythonnote{The wxChoice constructor in wxPython reduces the {\tt n} |
79 | and {\tt choices} arguments are to a single argument, which is | |
06d20283 RD |
80 | a list of strings.} |
81 | ||
5873607e VZ |
82 | \perlnote{In wxPerl there is just an array reference in place of {\tt n} |
83 | and {\tt choices}.} | |
84 | ||
a660d684 KB |
85 | \membersection{wxChoice::\destruct{wxChoice}} |
86 | ||
87 | \func{}{\destruct{wxChoice}}{\void} | |
88 | ||
89 | Destructor, destroying the choice item. | |
90 | ||
a660d684 KB |
91 | \membersection{wxChoice::Create}\label{wxchoicecreate} |
92 | ||
eaaa6a06 | 93 | \func{bool}{Create}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 | 94 | \param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp |
eaaa6a06 JS |
95 | \param{int}{ n}, \param{const wxString }{choices[]},\rtfsp |
96 | \param{long}{ style = 0}, \param{const wxString\& }{name = ``choice"}} | |
a660d684 KB |
97 | |
98 | Creates the choice for two-step construction. See \helpref{wxChoice::wxChoice}{wxchoiceconstr}. | |
99 | ||
645420d8 VZ |
100 | \membersection{wxChoice::Delete}\label{wxchoicedelete} |
101 | ||
102 | \func{void}{Delete}{\param{int }{n}} | |
103 | ||
104 | Deletes the item with the given index from the control. | |
105 | ||
106 | \wxheading{Parameters} | |
107 | ||
108 | \docparam{n}{The item to delete.} | |
109 | ||
a660d684 KB |
110 | \membersection{wxChoice::GetColumns}\label{wxchoicegetcolumns} |
111 | ||
112 | \constfunc{int}{GetColumns}{\void} | |
113 | ||
114 | Gets the number of columns in this choice item. | |
115 | ||
116 | \wxheading{Remarks} | |
117 | ||
bed5584e VZ |
118 | This is implemented for Motif only and always returns $1$ for the other |
119 | platforms. | |
9c884972 | 120 | |
a660d684 KB |
121 | \membersection{wxChoice::SetColumns}\label{wxchoicesetcolumns} |
122 | ||
eaaa6a06 | 123 | \func{void}{SetColumns}{\param{int}{ n = 1}} |
a660d684 KB |
124 | |
125 | Sets the number of columns in this choice item. | |
126 | ||
127 | \wxheading{Parameters} | |
128 | ||
129 | \docparam{n}{Number of columns.} | |
130 | ||
131 | \wxheading{Remarks} | |
132 | ||
bed5584e VZ |
133 | This is implemented for Motif only and doesn't do anything under other |
134 | platforms. | |
a660d684 | 135 |