]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/text.tex
Fix "depreciated" to "deprecated".
[wxWidgets.git] / docs / latex / wx / text.tex
CommitLineData
eda40bfc
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxTextCtrl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
a660d684
KB
3\section{\class{wxTextCtrl}}\label{wxtextctrl}
4
5A text control allows text to be displayed and edited. It may be
71777e2c 6single line or multi-line.
a660d684
KB
7
8\wxheading{Derived from}
9
10streambuf\\
11\helpref{wxControl}{wxcontrol}\\
12\helpref{wxWindow}{wxwindow}\\
13\helpref{wxEvtHandler}{wxevthandler}\\
14\helpref{wxObject}{wxobject}
15
954b8ae6
JS
16\wxheading{Include files}
17
18<wx/textctrl.h>
19
a660d684
KB
20\wxheading{Window styles}
21
22\twocolwidtha{5cm}
23\begin{twocollist}\itemsep=0pt
c50f1fb9 24\twocolitem{\windowstyle{wxTE\_PROCESS\_ENTER}}{The control will generate
01a01d10 25the event wxEVT\_COMMAND\_TEXT\_ENTER (otherwise pressing Enter key
0f66923e 26is either processed internally by the control or used for navigation between
c50f1fb9 27dialog controls).}
2edb0bde 28\twocolitem{\windowstyle{wxTE\_PROCESS\_TAB}}{The control will receive
01a01d10 29wxEVT\_CHAR events for TAB pressed - normally, TAB is used for passing to the
c50f1fb9
VZ
30next control in a dialog instead. For the control created with this style,
31you can still use Ctrl-Enter to pass to the next control from the keyboard.}
a660d684
KB
32\twocolitem{\windowstyle{wxTE\_MULTILINE}}{The text control allows multiple lines.}
33\twocolitem{\windowstyle{wxTE\_PASSWORD}}{The text will be echoed as asterisks.}
34\twocolitem{\windowstyle{wxTE\_READONLY}}{The text will not be user-editable.}
c57e3339 35\twocolitem{\windowstyle{wxTE\_RICH}}{Use rich text control under Win32, this
e119d049 36allows to have more than 64KB of text in the control even under Win9x. This
c57e3339 37style is ignored under other platforms.}
a5aa8086
VZ
38\twocolitem{\windowstyle{wxTE\_RICH2}}{Use rich text control version 2.0 or 3.0
39under Win32, this style is ignored under other platforms}
c57e3339 40\twocolitem{\windowstyle{wxTE\_AUTO\_URL}}{Highlight the URLs and generate the
d69b094f
KH
41wxTextUrlEvents when mouse events occur over them. This style is only supported
42for wxTE\_RICH Win32 and multi-line wxGTK2 text controls.}
5a8f04e3
VZ
43\twocolitem{\windowstyle{wxTE\_NOHIDESEL}}{By default, the Windows text control
44doesn't show the selection when it doesn't have focus - use this style to force
45it to always show it. It doesn't do anything under other platforms.}
0376ed54 46\twocolitem{\windowstyle{wxHSCROLL}}{A horizontal scrollbar will be created and
0fec2f73 47used, so that text won't be wrapped. No effect under wxGTK1.}
09b86e69
VZ
48\twocolitem{\windowstyle{wxTE\_NO\_VSCROLL}}{For multiline controls only:
49vertical scrollbar will never be created. This limits the amount of text which
50can be entered into the control to what can be displayed in it under MSW but
51not under GTK2. Currently not implemented for the other platforms.}
3908fe9b 52\twocolitem{\windowstyle{wxTE\_LEFT}}{The text in the control will be left-justified (default).}
c663fbea
VS
53\twocolitem{\windowstyle{wxTE\_CENTRE}}{The text in the control will be centered (currently wxMSW and wxGTK2 only).}
54\twocolitem{\windowstyle{wxTE\_RIGHT}}{The text in the control will be right-justified (currently wxMSW and wxGTK2 only).}
fb4888a6
VZ
55\twocolitem{\windowstyle{wxTE\_DONTWRAP}}{Same as {\tt wxHSCROLL} style: don't wrap at all, show horizontal scrollbar instead.}
56\twocolitem{\windowstyle{wxTE\_CHARWRAP}}{Wrap the lines too long to be shown entirely at any position (wxUniv and wxGTK2 only).}
57\twocolitem{\windowstyle{wxTE\_WORDWRAP}}{Wrap the lines too long to be shown entirely at word boundaries (wxUniv and wxGTK2 only).}
58\twocolitem{\windowstyle{wxTE\_BESTWRAP}}{Wrap the lines at word boundaries or at any other character if there are words longer than the window width (this is the default).}
b0dd9c00 59\twocolitem{\windowstyle{wxTE\_CAPITALIZE}}{On PocketPC and Smartphone, causes the first letter to be capitalized.}
a660d684
KB
60\end{twocollist}
61
b0dd9c00 62See also \helpref{window styles overview}{windowstyles} and \helpref{wxTextCtrl::wxTextCtrl}{wxtextctrlctor}.
a660d684 63
927637fd
VZ
64Note that alignment styles (\windowstyle{wxTE\_LEFT},
65\windowstyle{wxTE\_CENTRE} and \windowstyle{wxTE\_RIGHT}) can be changed
66dynamically after control creation on wxMSW and wxGTK.
67\windowstyle{wxTE\_READONLY}, \windowstyle{wxTE\_PASSWORD} and wrapping styles
68can be dynamically changed under wxGTK but not wxMSW. The other styles can be
69only set during control creation.
70
71
2b5f62a0
VZ
72\wxheading{wxTextCtrl text format}
73
74The multiline text controls always store the text as a sequence of lines
75separated by {\tt $\backslash$n} characters, i.e. in the Unix text format even
76on non-Unix platforms. This allows the user code to ignore the differences
77between the platforms but at a price: the indices in the control such as those
7d8268a1 78returned by \helpref{GetInsertionPoint}{wxtextctrlgetinsertionpoint} or
2b5f62a0
VZ
79\helpref{GetSelection}{wxtextctrlgetselection} can {\bf not} be used as
80indices into the string returned by \helpref{GetValue}{wxtextctrlgetvalue} as
7d8268a1 81they're going to be slightly off for platforms using
2b5f62a0
VZ
82{\tt $\backslash$r$\backslash$n} as separator (as Windows does), for example.
83
84Instead, if you need to obtain a substring between the $2$ indices obtained
85from the control with the help of the functions mentioned above, you should
86use \helpref{GetRange}{wxtextctrlgetrange}. And the indices themselves can
7d8268a1
WS
87only be passed to other methods, for example
88\helpref{SetInsertionPoint}{wxtextctrlsetinsertionpoint} or
2b5f62a0
VZ
89\helpref{SetSelection}{wxtextctrlsetselection}.
90
91To summarize: never use the indices returned by (multiline) wxTextCtrl as
92indices into the string it contains, but only as arguments to be passed back
93to the other wxTextCtrl methods.
94
eda40bfc
VZ
95\wxheading{wxTextCtrl styles}
96
97Multi-line text controls support the styles, i.e. provide a possibility to set
98colours and font for individual characters in it (note that under Windows {\tt
99wxTE\_RICH} style is required for style support). To use the styles you can
100either call \helpref{SetDefaultStyle}{wxtextctrlsetdefaultstyle} before
101inserting the text or call \helpref{SetStyle}{wxtextctrlsetstyle} later to
102change the style of the text already in the control (the first solution is
103much more efficient).
104
105In either case, if the style doesn't specify some of the attributes (for
106example you only want to set the text colour but without changing the font nor
107the text background), the values of the default style will be used for them.
108If there is no default style, the attributes of the text control itself are
109used.
110
111So the following code correctly describes what it does: the second call
112to \helpref{SetDefaultStyle}{wxtextctrlsetdefaultstyle} doesn't change the
113text foreground colour (which stays red) while the last one doesn't change the
114background colour (which stays grey):
115
116{\small%
117\begin{verbatim}
118 text->SetDefaultStyle(wxTextAttr(*wxRED));
119 text->AppendText("Red text\n");
120 text->SetDefaultStyle(wxTextAttr(wxNullColour, *wxLIGHT_GREY));
121 text->AppendText("Red on grey text\n");
122 text->SetDefaultStyle(wxTextAttr(*wxBLUE);
123 text->AppendText("Blue on grey text\n");
124\end{verbatim}
125}%
126
d73e6791 127\wxheading{wxTextCtrl and C++ streams}
a660d684 128
d73e6791
VZ
129This class multiply-inherits from {\bf streambuf} where compilers allow,
130allowing code such as the following:
a660d684
KB
131
132{\small%
133\begin{verbatim}
134 wxTextCtrl *control = new wxTextCtrl(...);
135
136 ostream stream(control)
137
138 stream << 123.456 << " some text\n";
139 stream.flush();
140\end{verbatim}
141}%
142
d73e6791
VZ
143If your compiler does not support derivation from {\bf streambuf} and gives a
144compile error, define the symbol {\bf NO\_TEXT\_WINDOW\_STREAM} in the
145wxTextCtrl header file.
9c884972 146
d73e6791
VZ
147Note that independently of this setting you can always use wxTextCtrl itself
148in a stream-like manner:
149
150{\small%
151\begin{verbatim}
152 wxTextCtrl *control = new wxTextCtrl(...);
153
154 *control << 123.456 << " some text\n";
155\end{verbatim}
156}%
157
158always works. However the possibility to create an ostream associated with
159wxTextCtrl may be useful if you need to redirect the output of a function
160taking an ostream as parameter to a text control.
161
162Another commonly requested need is to redirect {\bf std::cout} to the text
163control. This could be done in the following way:
164
165{\small%
166\begin{verbatim}
167 #include <iostream>
168
169 wxTextCtrl *control = new wxTextCtrl(...);
170
171 std::streambuf *sbOld = std::cout.rdbuf();
172 std::cout.rdbuf(*control);
173
174 // use cout as usual, the output appears in the text control
175 ...
176
177 std::cout.rdbuf(sbOld);
178\end{verbatim}
179}%
180
fc2171bd 181But wxWidgets provides a convenient class to make it even simpler so instead
d73e6791
VZ
182you may just do
183
184{\small%
185\begin{verbatim}
186 #include <iostream>
187
188 wxTextCtrl *control = new wxTextCtrl(...);
189
190 wxStreamToTextRedirector redirect(control);
191
192 // all output to cout goes into the text control until the exit from current
193 // scope
194\end{verbatim}
195}%
196
197See \helpref{wxStreamToTextRedirector}{wxstreamtotextredirector} for more
198details.
a660d684 199
562b0068
JS
200\wxheading{Constants}
201
202The values below are the possible return codes of the
203\helpref{HitTest}{wxtextctrlhittest} method:
204
205{\small
206\begin{verbatim}
207// the point asked is ...
208enum wxTextCtrlHitTestResult
209{
210 wxTE_HT_UNKNOWN = -2, // this means HitTest() is simply not implemented
211 wxTE_HT_BEFORE, // either to the left or upper
212 wxTE_HT_ON_TEXT, // directly on
213 wxTE_HT_BELOW, // below [the last line]
214 wxTE_HT_BEYOND // after [the end of line]
215};
216// ... the character returned
217\end{verbatim}
218}
219
220
5de76427
JS
221\wxheading{Event handling}
222
e702ff0f
JS
223The following commands are processed by default event handlers in wxTextCtrl: wxID\_CUT, wxID\_COPY,
224wxID\_PASTE, wxID\_UNDO, wxID\_REDO. The associated UI update events are also processed
225automatically, when the control has the focus.
226
5de76427
JS
227To process input from a text control, use these event handler macros to direct input to member
228functions that take a \helpref{wxCommandEvent}{wxcommandevent} argument.
229
230\twocolwidtha{7cm}%
231\begin{twocollist}\itemsep=0pt
232\twocolitem{{\bf EVT\_TEXT(id, func)}}{Respond to a wxEVT\_COMMAND\_TEXT\_UPDATED event,
f6519b40 233generated when the text changes. Notice that this event will be sent
a1665b22 234when the text controls contents changes - whether this is due to user input or
f6519b40
VZ
235comes from the program itself (for example, if SetValue() is called); see ChangeValue() for
236a function which does not send this event.}
5de76427 237\twocolitem{{\bf EVT\_TEXT\_ENTER(id, func)}}{Respond to a wxEVT\_COMMAND\_TEXT\_ENTER event,
0f66923e
VZ
238generated when enter is pressed in a text control (which must have
239wxTE\_PROCESS\_ENTER style for this event to be generated).}
43e8916f 240\twocolitem{{\bf EVT\_TEXT\_URL(id, func)}}{A mouse event occurred over an URL
d69b094f 241in the text control (wxMSW and wxGTK2 only)}
f2616db5 242\twocolitem{{\bf EVT\_TEXT\_MAXLEN(id, func)}}{User tried to enter more text
eef97940 243into the control than the limit set by
f2616db5 244\helpref{SetMaxLength}{wxtextctrlsetmaxlength}.}
5de76427
JS
245\end{twocollist}%
246
a660d684
KB
247\latexignore{\rtfignore{\wxheading{Members}}}
248
efe66bbc 249
15d83f72 250\membersection{wxTextCtrl::wxTextCtrl}\label{wxtextctrlctor}
a660d684
KB
251
252\func{}{wxTextCtrl}{\void}
253
254Default constructor.
255
eaaa6a06 256\func{}{wxTextCtrl}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp
aa8a815b
JS
257\param{const wxString\& }{value = ``"}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
258\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = wxTextCtrlNameStr}}
a660d684
KB
259
260Constructor, creating and showing a text control.
261
262\wxheading{Parameters}
263
264\docparam{parent}{Parent window. Should not be NULL.}
265
266\docparam{id}{Control identifier. A value of -1 denotes a default value.}
267
268\docparam{value}{Default text value.}
269
270\docparam{pos}{Text control position.}
271
272\docparam{size}{Text control size.}
273
274\docparam{style}{Window style. See \helpref{wxTextCtrl}{wxtextctrl}.}
275
276\docparam{validator}{Window validator.}
277
278\docparam{name}{Window name.}
279
280\wxheading{Remarks}
281
74ede4eb
VZ
282The horizontal scrollbar ({\bf wxHSCROLL} style flag) will only be created
283for multi-line text controls.
86975656 284Without a horizontal scrollbar, text lines that don't fit in the control's
71777e2c
HH
285size will be wrapped (but no newline character is inserted). Single line
286controls don't have a horizontal scrollbar, the text is automatically scrolled
86975656 287so that the \helpref{insertion point}{wxtextctrlgetinsertionpoint} is always
71777e2c
HH
288visible.
289
c57e3339
VZ
290% VZ: this is no longer true
291%Under Windows, if the {\bf wxTE\_MULTILINE} style is used, the window is implemented
292%as a Windows rich text control with unlimited capacity. Otherwise, normal edit control limits
293%apply.
a660d684
KB
294
295\wxheading{See also}
296
297\helpref{wxTextCtrl::Create}{wxtextctrlcreate}, \helpref{wxValidator}{wxvalidator}
298
efe66bbc 299
15d83f72 300\membersection{wxTextCtrl::\destruct{wxTextCtrl}}\label{wxtextctrldtor}
a660d684
KB
301
302\func{}{\destruct{wxTextCtrl}}{\void}
303
304Destructor, destroying the text control.
305
efe66bbc 306
ca8b28f2
JS
307\membersection{wxTextCtrl::AppendText}\label{wxtextctrlappendtext}
308
309\func{void}{AppendText}{\param{const wxString\& }{ text}}
310
311Appends the text to the end of the text control.
312
313\wxheading{Parameters}
314
315\docparam{text}{Text to write to the text control.}
316
317\wxheading{Remarks}
318
319After the text is appended, the insertion point will be at the end of the text control. If this behaviour is not desired,
320the programmer should use \helpref{GetInsertionPoint}{wxtextctrlgetinsertionpoint} and \helpref{SetInsertionPoint}{wxtextctrlsetinsertionpoint}.
321
322\wxheading{See also}
323
324\helpref{wxTextCtrl::WriteText}{wxtextctrlwritetext}
325
efe66bbc 326
ca8b28f2
JS
327\membersection{wxTextCtrl::CanCopy}\label{wxtextctrlcancopy}
328
329\func{virtual bool}{CanCopy}{\void}
330
cc81d32f 331Returns {\tt true} if the selection can be copied to the clipboard.
ca8b28f2 332
efe66bbc 333
ca8b28f2
JS
334\membersection{wxTextCtrl::CanCut}\label{wxtextctrlcancut}
335
336\func{virtual bool}{CanCut}{\void}
337
cc81d32f 338Returns {\tt true} if the selection can be cut to the clipboard.
ca8b28f2 339
efe66bbc 340
ca8b28f2
JS
341\membersection{wxTextCtrl::CanPaste}\label{wxtextctrlcanpaste}
342
343\func{virtual bool}{CanPaste}{\void}
344
cc81d32f 345Returns {\tt true} if the contents of the clipboard can be pasted into the
ca8b28f2 346text control. On some platforms (Motif, GTK) this is an approximation
cc81d32f 347and returns {\tt true} if the control is editable, {\tt false} otherwise.
ca8b28f2 348
efe66bbc 349
ca8b28f2
JS
350\membersection{wxTextCtrl::CanRedo}\label{wxtextctrlcanredo}
351
352\func{virtual bool}{CanRedo}{\void}
353
cc81d32f 354Returns {\tt true} if there is a redo facility available and the last operation
ca8b28f2
JS
355can be redone.
356
efe66bbc 357
ca8b28f2
JS
358\membersection{wxTextCtrl::CanUndo}\label{wxtextctrlcanundo}
359
360\func{virtual bool}{CanUndo}{\void}
361
cc81d32f 362Returns {\tt true} if there is an undo facility available and the last operation
ca8b28f2
JS
363can be undone.
364
efe66bbc 365
a660d684
KB
366\membersection{wxTextCtrl::Clear}\label{wxtextctrlclear}
367
368\func{virtual void}{Clear}{\void}
369
370Clears the text in the control.
371
674c474f
VZ
372Note that this function will generate a {\tt wxEVT\_COMMAND\_TEXT\_UPDATED}
373event.
374
efe66bbc 375
a660d684
KB
376\membersection{wxTextCtrl::Copy}\label{wxtextctrlcopy}
377
378\func{virtual void}{Copy}{\void}
379
380Copies the selected text to the clipboard under Motif and MS Windows.
381
efe66bbc 382
a660d684
KB
383\membersection{wxTextCtrl::Create}\label{wxtextctrlcreate}
384
eaaa6a06 385\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp
aa8a815b
JS
386\param{const wxString\& }{value = ``"}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
387\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = wxTextCtrlNameStr}}
a660d684
KB
388
389Creates the text control for two-step construction. Derived classes
15d83f72 390should call or replace this function. See \helpref{wxTextCtrl::wxTextCtrl}{wxtextctrlctor}\rtfsp
a660d684
KB
391for further details.
392
efe66bbc 393
a660d684
KB
394\membersection{wxTextCtrl::Cut}\label{wxtextctrlcut}
395
396\func{virtual void}{Cut}{\void}
397
398Copies the selected text to the clipboard and removes the selection.
399
efe66bbc 400
15d83f72 401\membersection{wxTextCtrl::DiscardEdits}\label{wxtextctrldiscardedits}
a660d684
KB
402
403\func{void}{DiscardEdits}{\void}
404
405Resets the internal `modified' flag as if the current edits had been saved.
406
efe66bbc 407
15d83f72 408\membersection{wxTextCtrl::EmulateKeyPress}\label{wxtextctrlemulatekeypress}
94af7d45
VZ
409
410\func{bool}{EmulateKeyPress}{\param{const wxKeyEvent\& }{event}}
411
412This functions inserts into the control the character which would have been
43e8916f 413inserted if the given key event had occurred in the text control. The
94af7d45 414{\it event} object should be the same as the one passed to {\tt EVT\_KEY\_DOWN}
fc2171bd 415handler previously by wxWidgets.
94af7d45 416
cd916794
VZ
417Please note that this function doesn't currently work correctly for all keys
418under any platform but MSW.
419
94af7d45
VZ
420\wxheading{Return value}
421
cc81d32f 422{\tt true} if the event resulted in a change to the control, {\tt false}
94af7d45
VZ
423otherwise.
424
efe66bbc 425
02a3b391 426\membersection{wxTextCtrl::GetDefaultStyle}\label{wxtextctrlgetdefaultstyle}
eda40bfc
VZ
427
428\constfunc{const wxTextAttr\& }{GetDefaultStyle}{\void}
429
430Returns the style currently used for the new text.
431
432\wxheading{See also}
433
434\helpref{SetDefaultStyle}{wxtextctrlsetdefaultstyle}
435
efe66bbc 436
a660d684
KB
437\membersection{wxTextCtrl::GetInsertionPoint}\label{wxtextctrlgetinsertionpoint}
438
439\constfunc{virtual long}{GetInsertionPoint}{\void}
440
71777e2c
HH
441Returns the insertion point. This is defined as the zero based index of the
442character position to the right of the insertion point. For example, if
443the insertion point is at the end of the text control, it is equal to
86975656
RD
444both \helpref{GetValue()}{wxtextctrlgetvalue}.Length() and
445\helpref{GetLastPosition()}{wxtextctrlgetlastposition}.
71777e2c
HH
446
447The following code snippet safely returns the character at the insertion
448point or the zero character if the point is at the end of the control.
449
450{\small%
451\begin{verbatim}
452 char GetCurrentChar(wxTextCtrl *tc) {
453 if (tc->GetInsertionPoint() == tc->GetLastPosition())
454 return '\0';
455 return tc->GetValue[tc->GetInsertionPoint()];
86975656 456 }
71777e2c
HH
457\end{verbatim}
458}%
a660d684 459
efe66bbc 460
a660d684
KB
461\membersection{wxTextCtrl::GetLastPosition}\label{wxtextctrlgetlastposition}
462
7d8268a1 463\constfunc{virtual wxTextPos}{GetLastPosition}{\void}
a660d684 464
86975656 465Returns the zero based index of the last position in the text control,
71777e2c 466which is equal to the number of characters in the control.
a660d684 467
efe66bbc 468
a660d684
KB
469\membersection{wxTextCtrl::GetLineLength}\label{wxtextctrlgetlinelength}
470
471\constfunc{int}{GetLineLength}{\param{long}{ lineNo}}
472
86975656 473Gets the length of the specified line, not including any trailing newline
71777e2c 474character(s).
a660d684
KB
475
476\wxheading{Parameters}
477
478\docparam{lineNo}{Line number (starting from zero).}
479
480\wxheading{Return value}
481
482The length of the line, or -1 if {\it lineNo} was invalid.
483
efe66bbc 484
a660d684
KB
485\membersection{wxTextCtrl::GetLineText}\label{wxtextctrlgetlinetext}
486
eaaa6a06 487\constfunc{wxString}{GetLineText}{\param{long}{ lineNo}}
a660d684 488
71777e2c
HH
489Returns the contents of a given line in the text control, not including
490any trailing newline character(s).
a660d684
KB
491
492\wxheading{Parameters}
493
494\docparam{lineNo}{The line number, starting from zero.}
495
496\wxheading{Return value}
497
498The contents of the line.
499
efe66bbc 500
a660d684
KB
501\membersection{wxTextCtrl::GetNumberOfLines}\label{wxtextctrlgetnumberoflines}
502
503\constfunc{int}{GetNumberOfLines}{\void}
504
505Returns the number of lines in the text control buffer.
506
71777e2c
HH
507\wxheading{Remarks}
508
509Note that even empty text controls have one line (where the insertion point
e894be20 510is), so GetNumberOfLines() never returns $0$.
71777e2c 511
e894be20
VZ
512For wxGTK using GTK+ 1.2.x and earlier, the number of lines in a multi-line
513text control is calculated by actually counting newline characters in the
514buffer, i.e. this function returns the number of logical lines and doesn't
515depend on whether any of them are wrapped. For all the other platforms, the
516number of physical lines in the control is returned.
517
518Also note that you may wish to avoid using functions that work with line
519numbers if you are working with controls that contain large amounts of text as
520this function has $O(N)$ complexity for $N$ being the number of lines.
71777e2c 521
efe66bbc 522
a5aa8086
VZ
523\membersection{wxTextCtrl::GetRange}\label{wxtextctrlgetrange}
524
525\constfunc{virtual wxString}{GetRange}{\param{long}{ from}, \param{long}{ to}}
526
43e8916f 527Returns the string containing the text starting in the positions {\it from} and
a5aa8086
VZ
528up to {\it to} in the control. The positions must have been returned by another
529wxTextCtrl method.
530
531Please note that the positions in a multiline wxTextCtrl do {\bf not}
7d8268a1 532correspond to the indices in the string returned by
a5aa8086
VZ
533\helpref{GetValue}{wxtextctrlgetvalue} because of the different new line
534representations ({\tt CR} or {\tt CR LF}) and so this method should be used to
535obtain the correct results instead of extracting parts of the entire value. It
536may also be more efficient, especially if the control contains a lot of data.
537
efe66bbc 538
ca8b28f2
JS
539\membersection{wxTextCtrl::GetSelection}\label{wxtextctrlgetselection}
540
a5aa8086 541\constfunc{virtual void}{GetSelection}{\param{long*}{ from}, \param{long*}{ to}}
ca8b28f2
JS
542
543Gets the current selection span. If the returned values are equal, there was
544no selection.
545
18414479
VZ
546Please note that the indices returned may be used with the other wxTextctrl
547methods but don't necessarily represent the correct indices into the string
548returned by \helpref{GetValue()}{wxtextctrlgetvalue} for multiline controls
eef97940
RD
549under Windows (at least,) you should use
550\helpref{GetStringSelection()}{wxtextctrlgetstringselection} to get the selected
18414479
VZ
551text.
552
ca8b28f2
JS
553\wxheading{Parameters}
554
555\docparam{from}{The returned first position.}
556
557\docparam{to}{The returned last position.}
558
86975656
RD
559\pythonnote{The wxPython version of this method returns a tuple
560consisting of the from and to values.}
561
5873607e
VZ
562\perlnote{In wxPerl this method takes no parameter and returns a
5632-element list {\tt ( from, to )}.}
564
efe66bbc 565
eef97940 566\membersection{wxTextCtrl::GetStringSelection}\label{wxtextctrlgetstringselection}
18414479 567
eef97940 568\func{virtual wxString}{GetStringSelection}{\void}
18414479
VZ
569
570Gets the text currently selected in the control. If there is no selection, the
571returned string is empty.
572
efe66bbc 573
e00a5d3c
JS
574\membersection{wxTextCtrl::GetStyle}\label{wxtextctrlgetstyle}
575
576\func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttr\& }{style}}
577
578Returns the style at this position in the text control. Not all platforms
579support this function.
580
581\wxheading{Return value}
582
43e8916f 583{\tt true} on success, {\tt false} if an error occurred - it may also mean that
e00a5d3c
JS
584the styles are not supported under this platform.
585
586\wxheading{See also}
587
588\helpref{wxTextCtrl::SetStyle}{wxtextctrlsetstyle}, \helpref{wxTextAttr}{wxtextattr}
589
efe66bbc 590
a660d684
KB
591\membersection{wxTextCtrl::GetValue}\label{wxtextctrlgetvalue}
592
593\constfunc{wxString}{GetValue}{\void}
594
9750fc42 595Gets the contents of the control. Notice that for a multiline text control,
2b5f62a0
VZ
596the lines will be separated by (Unix-style) $\backslash$n characters, even
597under Windows where they are separated by a $\backslash$r$\backslash$n
598sequence in the native control.
a660d684 599
efe66bbc
VZ
600
601\membersection{wxTextCtrl::HitTest}\label{wxtextctrlhittest}
602
603\constfunc{wxTextCtrlHitTestResult}{HitTest}{\param{const wxPoint\& }{pt}, \param{wxTextCoord }{*col}, \param{wxTextCoord }{*row}}
604
605This function finds the character at the specified position expressed in
606pixels. If the return code is not \texttt{wxTE\_HT\_UNKNOWN} the row and column
7d8268a1 607of the character closest to this position are returned in the \arg{col} and
b325f27f 608\arg{row} parameters (unless the pointers are {\tt NULL} which is allowed).
efe66bbc 609
692c9b86
VZ
610Please note that this function is currently only implemented in wxUniv,
611wxMSW and wxGTK2 ports.
efe66bbc
VZ
612
613\wxheading{See also}
614
e119d049 615\helpref{PositionToXY}{wxtextctrlpositiontoxy}, \helpref{XYToPosition}{wxtextctrlxytoposition}
efe66bbc 616
066f177c 617\perlnote{In wxPerl this function takes only the position argument and
e119d049 618returns a 3-element list \texttt{(result, col, row)}}.
efe66bbc 619
d4fbfbe5 620
9e3229b7
VZ
621\membersection{wxTextCtrl::IsEditable}\label{wxtextctrliseditable}
622
623\constfunc{bool}{IsEditable}{\void}
624
cc81d32f 625Returns {\tt true} if the controls contents may be edited by user (note that it
9e3229b7 626always can be changed by the program), i.e. if the control hasn't been put in
7d8268a1 627read-only mode by a previous call to
9e3229b7
VZ
628\helpref{SetEditable}{wxtextctrlseteditable}.
629
efe66bbc 630
d4fbfbe5
VZ
631\membersection{wxTextCtrl::IsEmpty}\label{wxtextctrlisempty}
632
633\constfunc{bool}{IsEmpty}{\void}
634
635Returns \true if the control is currently empty. This is the same as
636\texttt{GetValue().empty()} but can be much more efficient for the multiline
637controls containing big amounts of text.
638
639\newsince{2.7.1}
640
641
a660d684
KB
642\membersection{wxTextCtrl::IsModified}\label{wxtextctrlismodified}
643
644\constfunc{bool}{IsModified}{\void}
645
7d8268a1 646Returns {\tt true} if the text has been modified by user. Note that calling
29e1cfc2 647\helpref{SetValue}{wxtextctrlsetvalue} doesn't make the control modified.
a660d684 648
43e8916f
MW
649\wxheading{See also}
650
651\helpref{MarkDirty}{wxtextctrlmarkdirty}
652
efe66bbc 653
aa8e9a36
VZ
654\membersection{wxTextCtrl::IsMultiLine}\label{wxtextctrlismultiline}
655
656\constfunc{bool}{IsMultiLine}{\void}
657
cc81d32f 658Returns {\tt true} if this is a multi line edit control and {\tt false}
aa8e9a36
VZ
659otherwise.
660
661\wxheading{See also}
662
663\helpref{IsSingleLine}{wxtextctrlissingleline}
664
efe66bbc 665
aa8e9a36
VZ
666\membersection{wxTextCtrl::IsSingleLine}\label{wxtextctrlissingleline}
667
668\constfunc{bool}{IsSingleLine}{\void}
669
cc81d32f 670Returns {\tt true} if this is a single line edit control and {\tt false}
aa8e9a36
VZ
671otherwise.
672
673\wxheading{See also}
674
675\helpref{IsMultiLine}{wxtextctrlissingleline}
676
efe66bbc 677
a660d684
KB
678\membersection{wxTextCtrl::LoadFile}\label{wxtextctrlloadfile}
679
3306aec1 680\func{bool}{LoadFile}{\param{const wxString\& }{ filename}, \param{int }{fileType = wxTEXT\_TYPE\_ANY}}
a660d684
KB
681
682Loads and displays the named file, if it exists.
683
684\wxheading{Parameters}
685
686\docparam{filename}{The filename of the file to load.}
687
3306aec1
JS
688\docparam{fileType}{The type of file to load. This is currently ignored in wxTextCtrl.}
689
a660d684
KB
690\wxheading{Return value}
691
cc81d32f 692{\tt true} if successful, {\tt false} otherwise.
a660d684 693
d2d50a41
VZ
694% VZ: commenting this out as: (a) the docs are wrong (you can't replace
695% anything), (b) wxTextCtrl doesn't have any OnChar() anyhow
696%% \membersection{wxTextCtrl::OnChar}\label{wxtextctrlonchar}
7d8268a1 697%%
d2d50a41 698%% \func{void}{OnChar}{\param{wxKeyEvent\& }{event}}
7d8268a1 699%%
d2d50a41 700%% Default handler for character input.
7d8268a1 701%%
d2d50a41 702%% \wxheading{Remarks}
7d8268a1 703%%
d2d50a41
VZ
704%% It is possible to intercept character
705%% input by overriding this member. Call this function
706%% to let the default behaviour take place; not calling
707%% it results in the character being ignored. You can
708%% replace the {\it keyCode} member of {\it event} to
709%% translate keystrokes.
7d8268a1 710%%
d2d50a41
VZ
711%% Note that Windows and Motif have different ways
712%% of implementing the default behaviour. In Windows,
713%% calling wxTextCtrl::OnChar immediately
714%% processes the character. In Motif,
715%% calling this function simply sets a flag
716%% to let default processing happen. This might affect
717%% the way in which you write your OnChar function
718%% on different platforms.
7d8268a1 719%%
d2d50a41 720%% \wxheading{See also}
7d8268a1 721%%
d2d50a41 722%% \helpref{wxKeyEvent}{wxkeyevent}
a660d684 723
efe66bbc 724
43e8916f
MW
725\membersection{wxTextCtrl::MarkDirty}\label{wxtextctrlmarkdirty}
726
727\func{void}{MarkDirty}{\void}
728
729Mark text as modified (dirty).
730
731\wxheading{See also}
732
733\helpref{IsModified}{wxtextctrlismodified}
734
735
a660d684
KB
736\membersection{wxTextCtrl::OnDropFiles}\label{wxtextctrlondropfiles}
737
738\func{void}{OnDropFiles}{\param{wxDropFilesEvent\& }{event}}
739
740This event handler function implements default drag and drop behaviour, which
741is to load the first dropped file into the control.
742
743\wxheading{Parameters}
744
745\docparam{event}{The drop files event.}
746
71777e2c
HH
747\wxheading{Remarks}
748
b2cf617c 749This is not implemented on non-Windows platforms.
71777e2c 750
a660d684
KB
751\wxheading{See also}
752
753\helpref{wxDropFilesEvent}{wxdropfilesevent}
754
efe66bbc 755
a660d684
KB
756\membersection{wxTextCtrl::Paste}\label{wxtextctrlpaste}
757
758\func{virtual void}{Paste}{\void}
759
760Pastes text from the clipboard to the text item.
761
efe66bbc 762
a660d684
KB
763\membersection{wxTextCtrl::PositionToXY}\label{wxtextctrlpositiontoxy}
764
0efe5ba7 765\constfunc{bool}{PositionToXY}{\param{long }{pos}, \param{long *}{x}, \param{long *}{y}}
a660d684 766
71777e2c 767Converts given position to a zero-based column, line number pair.
a660d684
KB
768
769\wxheading{Parameters}
770
771\docparam{pos}{Position.}
772
71777e2c 773\docparam{x}{Receives zero based column number.}
a660d684 774
71777e2c
HH
775\docparam{y}{Receives zero based line number.}
776
777\wxheading{Return value}
778
cc81d32f 779{\tt true} on success, {\tt false} on failure (most likely due to a too large position
71777e2c 780parameter).
a660d684
KB
781
782\wxheading{See also}
783
784\helpref{wxTextCtrl::XYToPosition}{wxtextctrlxytoposition}
785
71777e2c
HH
786\pythonnote{In Python, PositionToXY() returns a tuple containing the x and
787y values, so (x,y) = PositionToXY() is equivalent to the call described
788above.}
789
5873607e
VZ
790\perlnote{In wxPerl this method only takes the {\tt pos} parameter, and
791returns a 2-element list {\tt ( x, y )}.}
792
efe66bbc 793
ca8b28f2
JS
794\membersection{wxTextCtrl::Redo}\label{wxtextctrlredo}
795
796\func{virtual void}{Redo}{\void}
797
798If there is a redo facility and the last operation can be redone, redoes the last operation. Does nothing
799if there is no redo facility.
800
efe66bbc 801
a660d684
KB
802\membersection{wxTextCtrl::Remove}\label{wxtextctrlremove}
803
eaaa6a06 804\func{virtual void}{Remove}{\param{long}{ from}, \param{long}{ to}}
a660d684 805
71777e2c
HH
806Removes the text starting at the first given position up to (but not including)
807the character at the last position.
a660d684
KB
808
809\wxheading{Parameters}
810
811\docparam{from}{The first position.}
812
813\docparam{to}{The last position.}
814
efe66bbc 815
a660d684
KB
816\membersection{wxTextCtrl::Replace}\label{wxtextctrlreplace}
817
eaaa6a06 818\func{virtual void}{Replace}{\param{long}{ from}, \param{long}{ to}, \param{const wxString\& }{value}}
a660d684 819
86975656 820Replaces the text starting at the first position up to (but not including)
71777e2c 821the character at the last position with the given text.
a660d684
KB
822
823\wxheading{Parameters}
824
825\docparam{from}{The first position.}
826
827\docparam{to}{The last position.}
828
829\docparam{value}{The value to replace the existing text with.}
830
efe66bbc 831
a660d684
KB
832\membersection{wxTextCtrl::SaveFile}\label{wxtextctrlsavefile}
833
3306aec1 834\func{bool}{SaveFile}{\param{const wxString\& }{ filename}, \param{int }{fileType = wxTEXT\_TYPE\_ANY}}
a660d684
KB
835
836Saves the contents of the control in a text file.
837
838\wxheading{Parameters}
839
71777e2c 840\docparam{filename}{The name of the file in which to save the text.}
a660d684 841
3306aec1
JS
842\docparam{fileType}{The type of file to save. This is currently ignored in wxTextCtrl.}
843
a660d684
KB
844\wxheading{Return value}
845
cc81d32f 846{\tt true} if the operation was successful, {\tt false} otherwise.
a660d684 847
efe66bbc 848
eda40bfc
VZ
849\membersection{wxTextCtrl::SetDefaultStyle}\label{wxtextctrlsetdefaultstyle}
850
851\func{bool}{SetDefaultStyle}{\param{const wxTextAttr\& }{style}}
852
853Changes the default style to use for the new text which is going to be added
854to the control using \helpref{WriteText}{wxtextctrlwritetext} or\rtfsp
855\helpref{AppendText}{wxtextctrlappendtext}.
856
857If either of the font, foreground, or background colour is not set in\rtfsp
858{\it style}, the values of the previous default style are used for them. If
859the previous default style didn't set them neither, the global font or colours
860of the text control itself are used as fall back.
861
c598f225
VZ
862However if the {\it style} parameter is the default wxTextAttr, then the
863default style is just reset (instead of being combined with the new style which
864wouldn't change it at all).
865
eda40bfc
VZ
866\wxheading{Parameters}
867
868\docparam{style}{The style for the new text.}
869
870\wxheading{Return value}
871
43e8916f 872{\tt true} on success, {\tt false} if an error occurred - may also mean that
eda40bfc
VZ
873the styles are not supported under this platform.
874
875\wxheading{See also}
876
877\helpref{GetDefaultStyle}{wxtextctrlgetdefaultstyle}
878
efe66bbc 879
a660d684
KB
880\membersection{wxTextCtrl::SetEditable}\label{wxtextctrlseteditable}
881
882\func{virtual void}{SetEditable}{\param{const bool}{ editable}}
883
b2cf617c 884Makes the text item editable or read-only, overriding the {\bf wxTE\_READONLY} flag.
a660d684
KB
885
886\wxheading{Parameters}
887
cc81d32f 888\docparam{editable}{If {\tt true}, the control is editable. If {\tt false}, the control is read-only.}
a660d684 889
9e3229b7
VZ
890\wxheading{See also}
891
892\helpref{IsEditable}{wxtextctrliseditable}
893
efe66bbc 894
a660d684
KB
895\membersection{wxTextCtrl::SetInsertionPoint}\label{wxtextctrlsetinsertionpoint}
896
eaaa6a06 897\func{virtual void}{SetInsertionPoint}{\param{long}{ pos}}
a660d684 898
71777e2c 899Sets the insertion point at the given position.
a660d684
KB
900
901\wxheading{Parameters}
902
903\docparam{pos}{Position to set.}
904
efe66bbc 905
a660d684
KB
906\membersection{wxTextCtrl::SetInsertionPointEnd}\label{wxtextctrlsetinsertionpointend}
907
908\func{virtual void}{SetInsertionPointEnd}{\void}
909
71777e2c
HH
910Sets the insertion point at the end of the text control. This is equivalent
911to \helpref{SetInsertionPoint}{wxtextctrlsetinsertionpoint}(\helpref{GetLastPosition}{wxtextctrlgetlastposition}()).
a660d684 912
efe66bbc 913
d7eee191
VZ
914\membersection{wxTextCtrl::SetMaxLength}\label{wxtextctrlsetmaxlength}
915
916\func{virtual void}{SetMaxLength}{\param{unsigned long }{len}}
917
918This function sets the maximum number of characters the user can enter into the
919control. In other words, it allows to limit the text value length to {\it len}
920not counting the terminating {\tt NUL} character.
921
2edb0bde 922If {\it len} is $0$, the previously set max length limit, if any, is discarded
5949fba6
VZ
923and the user may enter as much text as the underlying native text control
924widget supports (typically at least 32Kb).
925
d7eee191 926If the user tries to enter more characters into the text control when it
eef97940 927already is filled up to the maximal length, a
d7eee191
VZ
928{\tt wxEVT\_COMMAND\_TEXT\_MAXLEN} event is sent to notify the program about it
929(giving it the possibility to show an explanatory message, for example) and the
930extra input is discarded.
931
4a82116e 932Note that under GTK+, this function may only be used with single line text controls.
d7eee191
VZ
933
934\wxheading{Compatibility}
935
fc2171bd 936Only implemented in wxMSW/wxGTK starting with wxWidgets 2.3.2.
d7eee191 937
efe66bbc 938
be0ac181
VZ
939\membersection{wxTextCtrl::SetModified}\label{wxtextctrlsetmodified}
940
941\func{void}{SetModified}{\param{bool }{modified}}
942
943Marks the control as being modified by the user or not.
944
945\wxheading{See also}
946
947\helpref{MarkDirty}{wxtextctrlmarkdirty}, \helpref{DiscardEdits}{wxtextctrldiscardedits}
948
949
a660d684
KB
950\membersection{wxTextCtrl::SetSelection}\label{wxtextctrlsetselection}
951
eaaa6a06 952\func{virtual void}{SetSelection}{\param{long}{ from}, \param{long}{ to}}
a660d684 953
4d7b7fc2
VZ
954Selects the text starting at the first position up to (but not including) the
955character at the last position. If both parameters are equal to $-1$ all text
956in the control is selected.
a660d684
KB
957
958\wxheading{Parameters}
959
960\docparam{from}{The first position.}
961
962\docparam{to}{The last position.}
963
efe66bbc 964
eda40bfc
VZ
965\membersection{wxTextCtrl::SetStyle}\label{wxtextctrlsetstyle}
966
967\func{bool}{SetStyle}{\param{long }{start}, \param{long }{end}, \param{const wxTextAttr\& }{style}}
968
e00a5d3c 969Changes the style of the given range. If any attribute within {\it style} is
dbd94b75 970not set, the corresponding attribute from \helpref{GetDefaultStyle()}{wxtextctrlgetdefaultstyle} is used.
eda40bfc
VZ
971
972\wxheading{Parameters}
973
e00a5d3c 974\docparam{start}{The start of the range to change.}
eda40bfc 975
e00a5d3c 976\docparam{end}{The end of the range to change.}
eda40bfc 977
e00a5d3c 978\docparam{style}{The new style for the range.}
eda40bfc
VZ
979
980\wxheading{Return value}
981
43e8916f 982{\tt true} on success, {\tt false} if an error occurred - it may also mean that
eda40bfc
VZ
983the styles are not supported under this platform.
984
e00a5d3c
JS
985\wxheading{See also}
986
987\helpref{wxTextCtrl::GetStyle}{wxtextctrlgetstyle}, \helpref{wxTextAttr}{wxtextattr}
988
efe66bbc 989
a660d684
KB
990\membersection{wxTextCtrl::SetValue}\label{wxtextctrlsetvalue}
991
992\func{virtual void}{SetValue}{\param{const wxString\& }{ value}}
993
7d8268a1 994Sets the text value and marks the control as not-modified (which means that
cc81d32f 995\helpref{IsModified}{wxtextctrlismodified} would return {\tt false} immediately
29e1cfc2 996after the call to SetValue).
a660d684 997
674c474f
VZ
998Note that this function will generate a {\tt wxEVT\_COMMAND\_TEXT\_UPDATED}
999event.
1000
f6519b40
VZ
1001This function is deprecated and should not be used in new code. Please use the
1002\helpref{ChangeValue}{wxtextctrlchangevalue} function instead.
1003
1004\wxheading{Parameters}
1005
1006\docparam{value}{The new value to set. It may contain newline characters if the text control is multi-line.}
1007
1008
1009\membersection{wxTextCtrl::ChangeValue}\label{wxtextctrlchangevalue}
1010
1011\func{virtual void}{ChangeValue}{\param{const wxString\& }{ value}}
1012
1013Sets the text value and marks the control as not-modified (which means that
1014\helpref{IsModified}{wxtextctrlismodified} would return {\tt false} immediately
1015after the call to SetValue).
1016
1017Note that this function will \emph{not} generate the {\tt wxEVT\_COMMAND\_TEXT\_UPDATED}
1018event.
1019This is the only difference with \helpref{SetValue}{wxtextctrlsetvalue}.
b42a3531
VZ
1020See \helpref{this topic}{progevent} for more information.
1021
1022\newsince{2.7.1}
f6519b40 1023
a660d684
KB
1024\wxheading{Parameters}
1025
1026\docparam{value}{The new value to set. It may contain newline characters if the text control is multi-line.}
1027
efe66bbc 1028
a660d684
KB
1029\membersection{wxTextCtrl::ShowPosition}\label{wxtextctrlshowposition}
1030
eaaa6a06 1031\func{void}{ShowPosition}{\param{long}{ pos}}
a660d684
KB
1032
1033Makes the line containing the given position visible.
1034
1035\wxheading{Parameters}
1036
1037\docparam{pos}{The position that should be visible.}
1038
efe66bbc 1039
ca8b28f2
JS
1040\membersection{wxTextCtrl::Undo}\label{wxtextctrlundo}
1041
1042\func{virtual void}{Undo}{\void}
1043
1044If there is an undo facility and the last operation can be undone, undoes the last operation. Does nothing
1045if there is no undo facility.
1046
efe66bbc 1047
a660d684
KB
1048\membersection{wxTextCtrl::WriteText}\label{wxtextctrlwritetext}
1049
1050\func{void}{WriteText}{\param{const wxString\& }{ text}}
1051
86975656 1052Writes the text into the text control at the current insertion position.
a660d684
KB
1053
1054\wxheading{Parameters}
1055
1056\docparam{text}{Text to write to the text control.}
1057
1058\wxheading{Remarks}
1059
1060Newlines in the text string
1061are the only control characters allowed, and they will cause appropriate
abaa2936 1062line breaks. See \helpref{wxTextCtrl::\cinsert}{wxtextctrlinsert} and \helpref{wxTextCtrl::AppendText}{wxtextctrlappendtext} for more convenient ways of writing to the window.
71777e2c
HH
1063
1064After the write operation, the insertion point will be at the end of the inserted text, so subsequent write operations will be appended. To append text after the user may have interacted with the control, call \helpref{wxTextCtrl::SetInsertionPointEnd}{wxtextctrlsetinsertionpointend} before writing.
a660d684 1065
efe66bbc 1066
a660d684
KB
1067\membersection{wxTextCtrl::XYToPosition}\label{wxtextctrlxytoposition}
1068
eaaa6a06 1069\func{long}{XYToPosition}{\param{long}{ x}, \param{long}{ y}}
a660d684 1070
71777e2c 1071Converts the given zero based column and line number to a position.
a660d684
KB
1072
1073\wxheading{Parameters}
1074
71777e2c 1075\docparam{x}{The column number.}
a660d684 1076
71777e2c 1077\docparam{y}{The line number.}
a660d684
KB
1078
1079\wxheading{Return value}
1080
21d23b88 1081The position value, or -1 if {\tt x} or {\tt y} was invalid.
a660d684 1082
efe66bbc 1083
a660d684
KB
1084\membersection{wxTextCtrl::operator \cinsert}\label{wxtextctrlinsert}
1085
1086\func{wxTextCtrl\&}{operator \cinsert}{\param{const wxString\& }{s}}
1087
1088\func{wxTextCtrl\&}{operator \cinsert}{\param{int}{ i}}
1089
1090\func{wxTextCtrl\&}{operator \cinsert}{\param{long}{ i}}
1091
1092\func{wxTextCtrl\&}{operator \cinsert}{\param{float}{ f}}
1093
1094\func{wxTextCtrl\&}{operator \cinsert}{\param{double}{ d}}
1095
1096\func{wxTextCtrl\&}{operator \cinsert}{\param{char}{ c}}
1097
abaa2936 1098Operator definitions for appending to a text control, for example:
a660d684
KB
1099
1100\begin{verbatim}
1101 wxTextCtrl *wnd = new wxTextCtrl(my_frame);
1102
1103 (*wnd) << "Welcome to text control number " << 1 << ".\n";
1104\end{verbatim}
1105