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