]>
Commit | Line | Data |
---|---|---|
aa61d352 VZ |
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2 | %% Name: treectrl.tex | |
3 | %% Purpose: wxChoice documentation | |
4 | %% Author: wxWidgets Team | |
5 | %% Modified by: | |
6 | %% Created: | |
7 | %% RCS-ID: $Id$ | |
8 | %% Copyright: (c) wxWidgets Team | |
9 | %% License: wxWindows license | |
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
11 | ||
a660d684 KB |
12 | \section{\class{wxChoice}}\label{wxchoice} |
13 | ||
14 | A choice item is used to select one of a list of strings. Unlike a | |
15 | listbox, only the selection is visible until the user pulls down the | |
16 | menu of choices. | |
17 | ||
18 | \wxheading{Derived from} | |
19 | ||
bed5584e | 20 | \helpref{wxControlWithItems}{wxcontrolwithitems}\\ |
a660d684 KB |
21 | \helpref{wxControl}{wxcontrol}\\ |
22 | \helpref{wxWindow}{wxwindow}\\ | |
23 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
24 | \helpref{wxObject}{wxobject} | |
25 | ||
954b8ae6 JS |
26 | \wxheading{Include files} |
27 | ||
28 | <wx/choice.h> | |
29 | ||
a660d684 KB |
30 | \wxheading{Window styles} |
31 | ||
cb147822 VZ |
32 | \begin{twocollist}\itemsep=0pt |
33 | \twocolitem{\windowstyle{wxCB\_SORT}}{Sorts the entries alphabetically.} | |
34 | \end{twocollist} | |
a660d684 KB |
35 | |
36 | See also \helpref{window styles overview}{windowstyles}. | |
37 | ||
5de76427 JS |
38 | \wxheading{Event handling} |
39 | ||
40 | \twocolwidtha{7cm} | |
41 | \begin{twocollist}\itemsep=0pt | |
42 | \twocolitem{{\bf EVT\_CHOICE(id, func)}}{Process a wxEVT\_COMMAND\_CHOICE\_SELECTED event, | |
43 | when an item on the list is selected.} | |
44 | \end{twocollist} | |
45 | ||
a660d684 KB |
46 | \wxheading{See also} |
47 | ||
5de76427 JS |
48 | \helpref{wxListBox}{wxlistbox}, \helpref{wxComboBox}{wxcombobox}, |
49 | \rtfsp\helpref{wxCommandEvent}{wxcommandevent} | |
a660d684 KB |
50 | |
51 | \latexignore{\rtfignore{\wxheading{Members}}} | |
52 | ||
6ba93d23 | 53 | |
f510b7b2 | 54 | \membersection{wxChoice::wxChoice}\label{wxchoicector} |
a660d684 KB |
55 | |
56 | \func{}{wxChoice}{\void} | |
57 | ||
58 | Default constructor. | |
59 | ||
eaaa6a06 | 60 | \func{}{wxChoice}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 | 61 | \param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp |
eaaa6a06 JS |
62 | \param{int}{ n}, \param{const wxString }{choices[]},\rtfsp |
63 | \param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``choice"}} | |
a660d684 | 64 | |
56b88f12 MB |
65 | \func{}{wxChoice}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp |
66 | \param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp | |
67 | \param{const wxArrayString\& }{choices},\rtfsp | |
68 | \param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``choice"}} | |
69 | ||
a660d684 KB |
70 | Constructor, creating and showing a choice. |
71 | ||
72 | \wxheading{Parameters} | |
73 | ||
74 | \docparam{parent}{Parent window. Must not be NULL.} | |
75 | ||
76 | \docparam{id}{Window identifier. A value of -1 indicates a default value.} | |
77 | ||
78 | \docparam{pos}{Window position.} | |
79 | ||
80 | \docparam{size}{Window size. If the default size (-1, -1) is specified then the choice is sized | |
81 | appropriately.} | |
82 | ||
83 | \docparam{n}{Number of strings with which to initialise the choice control.} | |
84 | ||
85 | \docparam{choices}{An array of strings with which to initialise the choice control.} | |
86 | ||
87 | \docparam{style}{Window style. See \helpref{wxChoice}{wxchoice}.} | |
88 | ||
89 | \docparam{validator}{Window validator.} | |
90 | ||
91 | \docparam{name}{Window name.} | |
92 | ||
93 | \wxheading{See also} | |
94 | ||
95 | \helpref{wxChoice::Create}{wxchoicecreate}, \helpref{wxValidator}{wxvalidator} | |
96 | ||
c9110876 VS |
97 | \pythonnote{The wxChoice constructor in wxPython reduces the {\tt n} |
98 | and {\tt choices} arguments are to a single argument, which is | |
06d20283 RD |
99 | a list of strings.} |
100 | ||
5873607e VZ |
101 | \perlnote{In wxPerl there is just an array reference in place of {\tt n} |
102 | and {\tt choices}.} | |
103 | ||
6ba93d23 | 104 | |
f510b7b2 | 105 | \membersection{wxChoice::\destruct{wxChoice}}\label{wxchoicedtor} |
a660d684 KB |
106 | |
107 | \func{}{\destruct{wxChoice}}{\void} | |
108 | ||
109 | Destructor, destroying the choice item. | |
110 | ||
6ba93d23 | 111 | |
a660d684 KB |
112 | \membersection{wxChoice::Create}\label{wxchoicecreate} |
113 | ||
eaaa6a06 | 114 | \func{bool}{Create}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 | 115 | \param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp |
eaaa6a06 | 116 | \param{int}{ n}, \param{const wxString }{choices[]},\rtfsp |
f6e9a818 RN |
117 | \param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp |
118 | \param{const wxString\& }{name = ``choice"}} | |
a660d684 | 119 | |
56b88f12 MB |
120 | \func{bool}{Create}{\param{wxWindow *}{parent}, \param{wxWindowID}{ id},\rtfsp |
121 | \param{const wxPoint\& }{pos}, \param{const wxSize\&}{ size},\rtfsp | |
122 | \param{const wxArrayString\& }{choices},\rtfsp | |
f6e9a818 RN |
123 | \param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp |
124 | \param{const wxString\& }{name = ``choice"}} | |
56b88f12 | 125 | |
f510b7b2 | 126 | Creates the choice for two-step construction. See \helpref{wxChoice::wxChoice}{wxchoicector}. |
a660d684 | 127 | |
6ba93d23 | 128 | |
a660d684 KB |
129 | \membersection{wxChoice::GetColumns}\label{wxchoicegetcolumns} |
130 | ||
131 | \constfunc{int}{GetColumns}{\void} | |
132 | ||
133 | Gets the number of columns in this choice item. | |
134 | ||
135 | \wxheading{Remarks} | |
136 | ||
bed5584e VZ |
137 | This is implemented for Motif only and always returns $1$ for the other |
138 | platforms. | |
9c884972 | 139 | |
6ba93d23 VZ |
140 | |
141 | \membersection{wxChoice::GetCurrentSelection}\label{wxchoicegetcurrentselection} | |
142 | ||
143 | \constfunc{int}{GetCurrentSelection}{\void} | |
144 | ||
145 | Unlike \helpref{GetSelection}{wxcontrolwithitemsgetselection} which only | |
146 | returns the accepted selection value, i.e. the selection in the control once | |
147 | the user closes the dropdown list, this function returns the current selection. | |
148 | That is, while the dropdown list is shown, it returns the currently selected | |
149 | item in it. When it is not shown, its result is the same as for the other | |
150 | function. | |
151 | ||
aa61d352 | 152 | \newsince{2.6.2} (before this version |
6ba93d23 VZ |
153 | \helpref{GetSelection}{wxcontrolwithitemsgetselection} itself behaved like |
154 | this). | |
155 | ||
156 | ||
a660d684 KB |
157 | \membersection{wxChoice::SetColumns}\label{wxchoicesetcolumns} |
158 | ||
eaaa6a06 | 159 | \func{void}{SetColumns}{\param{int}{ n = 1}} |
a660d684 KB |
160 | |
161 | Sets the number of columns in this choice item. | |
162 | ||
163 | \wxheading{Parameters} | |
164 | ||
165 | \docparam{n}{Number of columns.} | |
166 | ||
167 | \wxheading{Remarks} | |
168 | ||
bed5584e VZ |
169 | This is implemented for Motif only and doesn't do anything under other |
170 | platforms. | |
b67a86d5 | 171 |