]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/combobox.tex
Extended wxTextAttr and added wxTextCtrl::GetStyle stub
[wxWidgets.git] / docs / latex / wx / combobox.tex
... / ...
CommitLineData
1\section{\class{wxComboBox}}\label{wxcombobox}
2
3A combobox is like a combination of an edit control and a listbox. It can be
4displayed as static list with editable or read-only text field; or a drop-down list with
5text field; or a drop-down list without a text field.
6
7A combobox permits a single selection only. Combobox items are numbered from zero.
8
9\wxheading{Derived from}
10
11\helpref{wxControlWithItems}{wxcontrolwithitems}\\
12\helpref{wxControl}{wxcontrol}\\
13\helpref{wxWindow}{wxwindow}\\
14\helpref{wxEvtHandler}{wxevthandler}\\
15\helpref{wxObject}{wxobject}
16
17\wxheading{Include files}
18
19<wx/combobox.h>
20
21\wxheading{Window styles}
22
23\begin{twocollist}\itemsep=0pt
24\twocolitem{\windowstyle{wxCB\_SIMPLE}}{Creates a combobox with a permanently displayed list. Windows only. }
25\twocolitem{\windowstyle{wxCB\_DROPDOWN}}{Creates a combobox with a drop-down list.}
26\twocolitem{\windowstyle{wxCB\_READONLY}}{Same as wxCB\_DROPDOWN but only the
27strings specified as the combobox choices can be selected, it is impossible to
28select (even from a program) a string which is not in the choices list.}
29\twocolitem{\windowstyle{wxCB\_SORT}}{Sorts the entries in the list alphabetically.}
30\end{twocollist}
31
32See also \helpref{window styles overview}{windowstyles}.
33
34\wxheading{Event handling}
35
36\twocolwidtha{7cm}
37\begin{twocollist}\itemsep=0pt
38\twocolitem{{\bf EVT\_COMBOBOX(id, func)}}{Process a wxEVT\_COMMAND\_COMBOBOX\_SELECTED event,
39when an item on the list is selected.}
40\twocolitem{{\bf EVT\_TEXT(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_UPDATED event,
41when the combobox text changes.}
42\end{twocollist}
43
44\wxheading{See also}
45
46\helpref{wxListBox}{wxlistbox}, \helpref{wxTextCtrl}{wxtextctrl}, \helpref{wxChoice}{wxchoice},
47\rtfsp\helpref{wxCommandEvent}{wxcommandevent}
48
49\latexignore{\rtfignore{\wxheading{Members}}}
50
51\membersection{wxComboBox::wxComboBox}\label{wxcomboboxconstr}
52
53\func{}{wxComboBox}{\void}
54
55Default constructor.
56
57\func{}{wxComboBox}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
58\param{const wxString\& }{value = ``"}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp
59\param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
60\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``comboBox"}}
61
62Constructor, creating and showing a combobox.
63
64\wxheading{Parameters}
65
66\docparam{parent}{Parent window. Must not be NULL.}
67
68\docparam{id}{Window identifier. A value of -1 indicates a default value.}
69
70\docparam{value}{Initial selection string. An empty string indicates no selection.}
71
72\docparam{pos}{Window position.}
73
74\docparam{size}{Window size. If the default size (-1, -1) is specified then the window is sized
75appropriately.}
76
77\docparam{n}{Number of strings with which to initialise the control.}
78
79\docparam{choices}{An array of strings with which to initialise the control.}
80
81\docparam{style}{Window style. See \helpref{wxComboBox}{wxcombobox}.}
82
83\docparam{validator}{Window validator.}
84
85\docparam{name}{Window name.}
86
87\wxheading{See also}
88
89\helpref{wxComboBox::Create}{wxcomboboxcreate}, \helpref{wxValidator}{wxvalidator}
90
91\pythonnote{The wxComboBox constructor in wxPython reduces the {\tt n}
92and {\tt choices} arguments are to a single argument, which is
93a list of strings.}
94
95\perlnote{In wxPerl there is just an array reference in place of {\tt n}
96and {\tt choices}.}
97
98\membersection{wxComboBox::\destruct{wxComboBox}}
99
100\func{}{\destruct{wxComboBox}}{\void}
101
102Destructor, destroying the combobox.
103
104\membersection{wxComboBox::Create}\label{wxcomboboxcreate}
105
106\func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
107\param{const wxString\& }{value = ``"}, \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp
108\param{int}{ n}, \param{const wxString }{choices[]},\rtfsp
109\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``comboBox"}}
110
111Creates the combobox for two-step construction. Derived classes
112should call or replace this function. See \helpref{wxComboBox::wxComboBox}{wxcomboboxconstr}\rtfsp
113for further details.
114
115\membersection{wxComboBox::Copy}\label{wxcomboboxcopy}
116
117\func{void}{Copy}{\void}
118
119Copies the selected text to the clipboard.
120
121\membersection{wxComboBox::Cut}\label{wxcomboboxcut}
122
123\func{void}{Cut}{\void}
124
125Copies the selected text to the clipboard and removes the selection.
126
127\membersection{wxComboBox::GetInsertionPoint}\label{wxcomboboxgetinsertionpoint}
128
129\constfunc{long}{GetInsertionPoint}{\void}
130
131Returns the insertion point for the combobox's text field.
132
133\membersection{wxComboBox::GetLastPosition}\label{wxcomboboxgetlastposition}
134
135\constfunc{long}{GetLastPosition}{\void}
136
137Returns the last position in the combobox text field.
138
139\membersection{wxComboBox::GetValue}\label{wxcomboboxgetvalue}
140
141\constfunc{wxString}{GetValue}{\void}
142
143Returns the current value in the combobox text field.
144
145\membersection{wxComboBox::Paste}\label{wxcomboboxpaste}
146
147\func{void}{Paste}{\void}
148
149Pastes text from the clipboard to the text field.
150
151\membersection{wxComboBox::Replace}\label{wxcomboboxreplace}
152
153\func{void}{Replace}{\param{long}{ from}, \param{long}{ to}, \param{const wxString\& }{text}}
154
155Replaces the text between two positions with the given text, in the combobox text field.
156
157\wxheading{Parameters}
158
159\docparam{from}{The first position.}
160
161\docparam{to}{The second position.}
162
163\docparam{text}{The text to insert.}
164
165\membersection{wxComboBox::Remove}\label{wxcomboboxremove}
166
167\func{void}{Remove}{\param{long}{ from}, \param{long}{ to}}
168
169Removes the text between the two positions in the combobox text field.
170
171\wxheading{Parameters}
172
173\docparam{from}{The first position.}
174
175\docparam{to}{The last position.}
176
177\membersection{wxComboBox::SetInsertionPoint}\label{wxcomboboxsetinsertionpoint}
178
179\func{void}{SetInsertionPoint}{\param{long}{ pos}}
180
181Sets the insertion point in the combobox text field.
182
183\wxheading{Parameters}
184
185\docparam{pos}{The new insertion point.}
186
187\membersection{wxComboBox::SetInsertionPointEnd}\label{wxcomboboxsetinsertionpointend}
188
189\func{void}{SetInsertionPointEnd}{\void}
190
191Sets the insertion point at the end of the combobox text field.
192
193\membersection{wxComboBox::SetSelection}\label{wxcomboboxsetselection}
194
195\func{void}{SetSelection}{\param{long}{ from}, \param{long}{ to}}
196
197Selects the text between the two positions, in the combobox text field.
198
199\wxheading{Parameters}
200
201\docparam{from}{The first position.}
202
203\docparam{to}{The second position.}
204
205\pythonnote{This method is called {\tt SetMark} in wxPython, {\tt SetSelection}
206name is kept for
207\helpref{wxControlWithItems::SetSelection}{wxcontrolwithitemssetselection}.}
208
209\membersection{wxComboBox::SetValue}\label{wxcomboboxsetvalue}
210
211\func{void}{SetValue}{\param{const wxString\& }{text}}
212
213Sets the text for the combobox text field.
214
215{\bf NB:} For a combobox with {\tt wxCB\_READONLY} style the string must be in
216the combobox choices list, otherwise the call to SetValue() is ignored.
217
218\wxheading{Parameters}
219
220\docparam{text}{The text to set.}
221
222