]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/text.tex
removed wxGetTranslation already defined in wx intl
[wxWidgets.git] / docs / latex / wx / text.tex
CommitLineData
a660d684
KB
1\section{\class{wxTextCtrl}}\label{wxtextctrl}
2
3A text control allows text to be displayed and edited. It may be
71777e2c 4single line or multi-line.
a660d684
KB
5
6\wxheading{Derived from}
7
8streambuf\\
9\helpref{wxControl}{wxcontrol}\\
10\helpref{wxWindow}{wxwindow}\\
11\helpref{wxEvtHandler}{wxevthandler}\\
12\helpref{wxObject}{wxobject}
13
954b8ae6
JS
14\wxheading{Include files}
15
16<wx/textctrl.h>
17
a660d684
KB
18\wxheading{Window styles}
19
20\twocolwidtha{5cm}
21\begin{twocollist}\itemsep=0pt
c50f1fb9
VZ
22\twocolitem{\windowstyle{wxTE\_PROCESS\_ENTER}}{The control will generate
23the message wxEVENT\_TYPE\_TEXT\_ENTER\_COMMAND (otherwise pressing <Enter> is
24either processed internally by the control or used for navigation between
25dialog controls).}
26\twocolitem{\windowstyle{wxTE\_PROCESS\_TAB}}{The control will receieve
27EVT\_CHAR messages for TAB pressed - normally, TAB is used for passing to the
28next control in a dialog instead. For the control created with this style,
29you can still use Ctrl-Enter to pass to the next control from the keyboard.}
a660d684
KB
30\twocolitem{\windowstyle{wxTE\_MULTILINE}}{The text control allows multiple lines.}
31\twocolitem{\windowstyle{wxTE\_PASSWORD}}{The text will be echoed as asterisks.}
32\twocolitem{\windowstyle{wxTE\_READONLY}}{The text will not be user-editable.}
c57e3339
VZ
33\twocolitem{\windowstyle{wxTE\_RICH}}{Use rich text control under Win32, this
34allows to have more than 64Kb of text in the control even under Win9x. This
35style is ignored under other platforms.}
36\twocolitem{\windowstyle{wxTE\_AUTO\_URL}}{Highlight the URLs and generate the
37wxTextUrlEvents when mouse events occur over them. This style is supported
38under Win32 only and requires wxTE\_RICH.}
5a8f04e3
VZ
39\twocolitem{\windowstyle{wxTE\_NOHIDESEL}}{By default, the Windows text control
40doesn't show the selection when it doesn't have focus - use this style to force
41it to always show it. It doesn't do anything under other platforms.}
9c884972 42\twocolitem{\windowstyle{wxHSCROLL}}{A horizontal scrollbar will be created. No effect under GTK+.}
a660d684
KB
43\end{twocollist}
44
b2cf617c 45See also \helpref{window styles overview}{windowstyles} and
f66205b6 46\helpref{wxTextCtrl::wxTextCtrl}{wxtextctrlconstr}.
a660d684
KB
47
48\wxheading{Remarks}
49
9c884972
RR
50This class multiply-inherits from {\bf streambuf} where compilers allow, allowing code such as
51the following:
a660d684
KB
52
53{\small%
54\begin{verbatim}
55 wxTextCtrl *control = new wxTextCtrl(...);
56
57 ostream stream(control)
58
59 stream << 123.456 << " some text\n";
60 stream.flush();
61\end{verbatim}
62}%
63
9c884972
RR
64If your compiler does not support derivation from {\bf streambuf} and gives a compile error, define the symbol
65{\bf NO\_TEXT\_WINDOW\_STREAM} in the wxTextCtrl header file.
66
c57e3339
VZ
67% VZ: it is wrong to say that C++ iostreams are deprecated, we need a better
68% wording here - disabling this for now
69%Note that any use of C++ iostreams (including this one) is deprecated and might
70%get completely removed in the future.
a660d684 71
5de76427
JS
72\wxheading{Event handling}
73
e702ff0f
JS
74The following commands are processed by default event handlers in wxTextCtrl: wxID\_CUT, wxID\_COPY,
75wxID\_PASTE, wxID\_UNDO, wxID\_REDO. The associated UI update events are also processed
76automatically, when the control has the focus.
77
5de76427
JS
78To process input from a text control, use these event handler macros to direct input to member
79functions that take a \helpref{wxCommandEvent}{wxcommandevent} argument.
80
81\twocolwidtha{7cm}%
82\begin{twocollist}\itemsep=0pt
83\twocolitem{{\bf EVT\_TEXT(id, func)}}{Respond to a wxEVT\_COMMAND\_TEXT\_UPDATED event,
a1665b22
VZ
84generated when the text changes. Notice that this event will always be sent
85when the text controls contents changes - whether this is due to user input or
86comes from the program itself (for example, if SetValue() is called)}
5de76427
JS
87\twocolitem{{\bf EVT\_TEXT\_ENTER(id, func)}}{Respond to a wxEVT\_COMMAND\_TEXT\_ENTER event,
88generated when enter is pressed in a single-line text control.}
f2616db5
VZ
89\twocolitem{{\bf EVT\_TEXT\_URL(id, func)}}{A mouse event occured over an URL
90in the text control (Win32 only)}
91\twocolitem{{\bf EVT\_TEXT\_MAXLEN(id, func)}}{User tried to enter more text
92into the control than the limit set by
93\helpref{SetMaxLength}{wxtextctrlsetmaxlength}.}
5de76427
JS
94\end{twocollist}%
95
a660d684
KB
96%\wxheading{See also}
97%
98%\helpref{wxRichTextCtrl}{wxrichtextctrl}
99%
100\latexignore{\rtfignore{\wxheading{Members}}}
101
102\membersection{wxTextCtrl::wxTextCtrl}\label{wxtextctrlconstr}
103
104\func{}{wxTextCtrl}{\void}
105
106Default constructor.
107
eaaa6a06 108\func{}{wxTextCtrl}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp
36b3b54a 109\param{const wxString\& }{value = ``"}, \param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
eaaa6a06 110\param{long}{ style = 0}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``text"}}
a660d684
KB
111
112Constructor, creating and showing a text control.
113
114\wxheading{Parameters}
115
116\docparam{parent}{Parent window. Should not be NULL.}
117
118\docparam{id}{Control identifier. A value of -1 denotes a default value.}
119
120\docparam{value}{Default text value.}
121
122\docparam{pos}{Text control position.}
123
124\docparam{size}{Text control size.}
125
126\docparam{style}{Window style. See \helpref{wxTextCtrl}{wxtextctrl}.}
127
128\docparam{validator}{Window validator.}
129
130\docparam{name}{Window name.}
131
132\wxheading{Remarks}
133
86975656
RD
134The horizontal scrollbar ({\bf wxTE\_HSCROLL} style flag) will only be created for multi-line text controls.
135Without a horizontal scrollbar, text lines that don't fit in the control's
71777e2c
HH
136size will be wrapped (but no newline character is inserted). Single line
137controls don't have a horizontal scrollbar, the text is automatically scrolled
86975656 138so that the \helpref{insertion point}{wxtextctrlgetinsertionpoint} is always
71777e2c
HH
139visible.
140
c57e3339
VZ
141% VZ: this is no longer true
142%Under Windows, if the {\bf wxTE\_MULTILINE} style is used, the window is implemented
143%as a Windows rich text control with unlimited capacity. Otherwise, normal edit control limits
144%apply.
a660d684
KB
145
146\wxheading{See also}
147
148\helpref{wxTextCtrl::Create}{wxtextctrlcreate}, \helpref{wxValidator}{wxvalidator}
149
150\membersection{wxTextCtrl::\destruct{wxTextCtrl}}
151
152\func{}{\destruct{wxTextCtrl}}{\void}
153
154Destructor, destroying the text control.
155
ca8b28f2
JS
156\membersection{wxTextCtrl::AppendText}\label{wxtextctrlappendtext}
157
158\func{void}{AppendText}{\param{const wxString\& }{ text}}
159
160Appends the text to the end of the text control.
161
162\wxheading{Parameters}
163
164\docparam{text}{Text to write to the text control.}
165
166\wxheading{Remarks}
167
168After the text is appended, the insertion point will be at the end of the text control. If this behaviour is not desired,
169the programmer should use \helpref{GetInsertionPoint}{wxtextctrlgetinsertionpoint} and \helpref{SetInsertionPoint}{wxtextctrlsetinsertionpoint}.
170
171\wxheading{See also}
172
173\helpref{wxTextCtrl::WriteText}{wxtextctrlwritetext}
174
175\membersection{wxTextCtrl::CanCopy}\label{wxtextctrlcancopy}
176
177\func{virtual bool}{CanCopy}{\void}
178
179Returns TRUE if the selection can be copied to the clipboard.
180
181\membersection{wxTextCtrl::CanCut}\label{wxtextctrlcancut}
182
183\func{virtual bool}{CanCut}{\void}
184
185Returns TRUE if the selection can be cut to the clipboard.
186
187\membersection{wxTextCtrl::CanPaste}\label{wxtextctrlcanpaste}
188
189\func{virtual bool}{CanPaste}{\void}
190
191Returns TRUE if the contents of the clipboard can be pasted into the
192text control. On some platforms (Motif, GTK) this is an approximation
193and returns TRUE if the control is editable, FALSE otherwise.
194
195\membersection{wxTextCtrl::CanRedo}\label{wxtextctrlcanredo}
196
197\func{virtual bool}{CanRedo}{\void}
198
199Returns TRUE if there is a redo facility available and the last operation
200can be redone.
201
202\membersection{wxTextCtrl::CanUndo}\label{wxtextctrlcanundo}
203
204\func{virtual bool}{CanUndo}{\void}
205
206Returns TRUE if there is an undo facility available and the last operation
207can be undone.
208
a660d684
KB
209\membersection{wxTextCtrl::Clear}\label{wxtextctrlclear}
210
211\func{virtual void}{Clear}{\void}
212
213Clears the text in the control.
214
215\membersection{wxTextCtrl::Copy}\label{wxtextctrlcopy}
216
217\func{virtual void}{Copy}{\void}
218
219Copies the selected text to the clipboard under Motif and MS Windows.
220
221\membersection{wxTextCtrl::Create}\label{wxtextctrlcreate}
222
eaaa6a06 223\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp
36b3b54a 224\param{const wxString\& }{value = ``"}, \param{const wxPoint\& }{pos}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
eaaa6a06 225\param{long}{ style = 0}, \param{const wxValidator\& }{validator}, \param{const wxString\& }{name = ``text"}}
a660d684
KB
226
227Creates the text control for two-step construction. Derived classes
228should call or replace this function. See \helpref{wxTextCtrl::wxTextCtrl}{wxtextctrlconstr}\rtfsp
229for further details.
230
231\membersection{wxTextCtrl::Cut}\label{wxtextctrlcut}
232
233\func{virtual void}{Cut}{\void}
234
235Copies the selected text to the clipboard and removes the selection.
236
237\membersection{wxTextCtrl::DiscardEdits}
238
239\func{void}{DiscardEdits}{\void}
240
241Resets the internal `modified' flag as if the current edits had been saved.
242
243\membersection{wxTextCtrl::GetInsertionPoint}\label{wxtextctrlgetinsertionpoint}
244
245\constfunc{virtual long}{GetInsertionPoint}{\void}
246
71777e2c
HH
247Returns the insertion point. This is defined as the zero based index of the
248character position to the right of the insertion point. For example, if
249the insertion point is at the end of the text control, it is equal to
86975656
RD
250both \helpref{GetValue()}{wxtextctrlgetvalue}.Length() and
251\helpref{GetLastPosition()}{wxtextctrlgetlastposition}.
71777e2c
HH
252
253The following code snippet safely returns the character at the insertion
254point or the zero character if the point is at the end of the control.
255
256{\small%
257\begin{verbatim}
258 char GetCurrentChar(wxTextCtrl *tc) {
259 if (tc->GetInsertionPoint() == tc->GetLastPosition())
260 return '\0';
261 return tc->GetValue[tc->GetInsertionPoint()];
86975656 262 }
71777e2c
HH
263\end{verbatim}
264}%
a660d684
KB
265
266\membersection{wxTextCtrl::GetLastPosition}\label{wxtextctrlgetlastposition}
267
268\constfunc{virtual long}{GetLastPosition}{\void}
269
86975656 270Returns the zero based index of the last position in the text control,
71777e2c 271which is equal to the number of characters in the control.
a660d684
KB
272
273\membersection{wxTextCtrl::GetLineLength}\label{wxtextctrlgetlinelength}
274
275\constfunc{int}{GetLineLength}{\param{long}{ lineNo}}
276
86975656 277Gets the length of the specified line, not including any trailing newline
71777e2c 278character(s).
a660d684
KB
279
280\wxheading{Parameters}
281
282\docparam{lineNo}{Line number (starting from zero).}
283
284\wxheading{Return value}
285
286The length of the line, or -1 if {\it lineNo} was invalid.
287
288\membersection{wxTextCtrl::GetLineText}\label{wxtextctrlgetlinetext}
289
eaaa6a06 290\constfunc{wxString}{GetLineText}{\param{long}{ lineNo}}
a660d684 291
71777e2c
HH
292Returns the contents of a given line in the text control, not including
293any trailing newline character(s).
a660d684
KB
294
295\wxheading{Parameters}
296
297\docparam{lineNo}{The line number, starting from zero.}
298
299\wxheading{Return value}
300
301The contents of the line.
302
303\membersection{wxTextCtrl::GetNumberOfLines}\label{wxtextctrlgetnumberoflines}
304
305\constfunc{int}{GetNumberOfLines}{\void}
306
307Returns the number of lines in the text control buffer.
308
71777e2c
HH
309\wxheading{Remarks}
310
311Note that even empty text controls have one line (where the insertion point
312is), so GetNumberOfLines() never returns 0.
313
314For gtk\_text (multi-line) controls, the number of lines is
315calculated by actually counting newline characters in the buffer. You
316may wish to avoid using functions that work with line numbers if you are
317working with controls that contain large amounts of text.
318
ca8b28f2
JS
319\membersection{wxTextCtrl::GetSelection}\label{wxtextctrlgetselection}
320
321\func{virtual void}{GetSelection}{\param{long*}{ from}, \param{long*}{ to}}
322
323Gets the current selection span. If the returned values are equal, there was
324no selection.
325
326\wxheading{Parameters}
327
328\docparam{from}{The returned first position.}
329
330\docparam{to}{The returned last position.}
331
86975656
RD
332\pythonnote{The wxPython version of this method returns a tuple
333consisting of the from and to values.}
334
5873607e
VZ
335\perlnote{In wxPerl this method takes no parameter and returns a
3362-element list {\tt ( from, to )}.}
337
a660d684
KB
338\membersection{wxTextCtrl::GetValue}\label{wxtextctrlgetvalue}
339
340\constfunc{wxString}{GetValue}{\void}
341
9750fc42 342Gets the contents of the control. Notice that for a multiline text control,
b2cf617c
JS
343the lines will be separated by (Unix-style) $\backslash$n characters, even under
344Windows where they are separated by a $\backslash$r$\backslash$n sequence in the native control.
a660d684
KB
345
346\membersection{wxTextCtrl::IsModified}\label{wxtextctrlismodified}
347
348\constfunc{bool}{IsModified}{\void}
349
350Returns TRUE if the text has been modified.
351
352\membersection{wxTextCtrl::LoadFile}\label{wxtextctrlloadfile}
353
354\func{bool}{LoadFile}{\param{const wxString\& }{ filename}}
355
356Loads and displays the named file, if it exists.
357
358\wxheading{Parameters}
359
360\docparam{filename}{The filename of the file to load.}
361
362\wxheading{Return value}
363
364TRUE if successful, FALSE otherwise.
365
366\membersection{wxTextCtrl::OnChar}\label{wxtextctrlonchar}
367
368\func{void}{OnChar}{\param{wxKeyEvent\& }{event}}
369
370Default handler for character input.
371
372\wxheading{Remarks}
373
374It is possible to intercept character
375input by overriding this member. Call this function
376to let the default behaviour take place; not calling
377it results in the character being ignored. You can
378replace the {\it keyCode} member of {\it event} to
379translate keystrokes.
380
381Note that Windows and Motif have different ways
382of implementing the default behaviour. In Windows,
383calling wxTextCtrl::OnChar immediately
384processes the character. In Motif,
385calling this function simply sets a flag
386to let default processing happen. This might affect
387the way in which you write your OnChar function
388on different platforms.
389
390\wxheading{See also}
391
392\helpref{wxKeyEvent}{wxkeyevent}
393
394\membersection{wxTextCtrl::OnDropFiles}\label{wxtextctrlondropfiles}
395
396\func{void}{OnDropFiles}{\param{wxDropFilesEvent\& }{event}}
397
398This event handler function implements default drag and drop behaviour, which
399is to load the first dropped file into the control.
400
401\wxheading{Parameters}
402
403\docparam{event}{The drop files event.}
404
71777e2c
HH
405\wxheading{Remarks}
406
b2cf617c 407This is not implemented on non-Windows platforms.
71777e2c 408
a660d684
KB
409\wxheading{See also}
410
411\helpref{wxDropFilesEvent}{wxdropfilesevent}
412
413\membersection{wxTextCtrl::Paste}\label{wxtextctrlpaste}
414
415\func{virtual void}{Paste}{\void}
416
417Pastes text from the clipboard to the text item.
418
419\membersection{wxTextCtrl::PositionToXY}\label{wxtextctrlpositiontoxy}
420
0efe5ba7 421\constfunc{bool}{PositionToXY}{\param{long }{pos}, \param{long *}{x}, \param{long *}{y}}
a660d684 422
71777e2c 423Converts given position to a zero-based column, line number pair.
a660d684
KB
424
425\wxheading{Parameters}
426
427\docparam{pos}{Position.}
428
71777e2c 429\docparam{x}{Receives zero based column number.}
a660d684 430
71777e2c
HH
431\docparam{y}{Receives zero based line number.}
432
433\wxheading{Return value}
434
0efe5ba7 435TRUE on success, FALSE on failure (most likely due to a too large position
71777e2c 436parameter).
a660d684
KB
437
438\wxheading{See also}
439
440\helpref{wxTextCtrl::XYToPosition}{wxtextctrlxytoposition}
441
71777e2c
HH
442\pythonnote{In Python, PositionToXY() returns a tuple containing the x and
443y values, so (x,y) = PositionToXY() is equivalent to the call described
444above.}
445
5873607e
VZ
446\perlnote{In wxPerl this method only takes the {\tt pos} parameter, and
447returns a 2-element list {\tt ( x, y )}.}
448
ca8b28f2
JS
449\membersection{wxTextCtrl::Redo}\label{wxtextctrlredo}
450
451\func{virtual void}{Redo}{\void}
452
453If there is a redo facility and the last operation can be redone, redoes the last operation. Does nothing
454if there is no redo facility.
455
a660d684
KB
456\membersection{wxTextCtrl::Remove}\label{wxtextctrlremove}
457
eaaa6a06 458\func{virtual void}{Remove}{\param{long}{ from}, \param{long}{ to}}
a660d684 459
71777e2c
HH
460Removes the text starting at the first given position up to (but not including)
461the character at the last position.
a660d684
KB
462
463\wxheading{Parameters}
464
465\docparam{from}{The first position.}
466
467\docparam{to}{The last position.}
468
469\membersection{wxTextCtrl::Replace}\label{wxtextctrlreplace}
470
eaaa6a06 471\func{virtual void}{Replace}{\param{long}{ from}, \param{long}{ to}, \param{const wxString\& }{value}}
a660d684 472
86975656 473Replaces the text starting at the first position up to (but not including)
71777e2c 474the character at the last position with the given text.
a660d684
KB
475
476\wxheading{Parameters}
477
478\docparam{from}{The first position.}
479
480\docparam{to}{The last position.}
481
482\docparam{value}{The value to replace the existing text with.}
483
484\membersection{wxTextCtrl::SaveFile}\label{wxtextctrlsavefile}
485
486\func{bool}{SaveFile}{\param{const wxString\& }{ filename}}
487
488Saves the contents of the control in a text file.
489
490\wxheading{Parameters}
491
71777e2c 492\docparam{filename}{The name of the file in which to save the text.}
a660d684
KB
493
494\wxheading{Return value}
495
496TRUE if the operation was successful, FALSE otherwise.
497
498\membersection{wxTextCtrl::SetEditable}\label{wxtextctrlseteditable}
499
500\func{virtual void}{SetEditable}{\param{const bool}{ editable}}
501
b2cf617c 502Makes the text item editable or read-only, overriding the {\bf wxTE\_READONLY} flag.
a660d684
KB
503
504\wxheading{Parameters}
505
506\docparam{editable}{If TRUE, the control is editable. If FALSE, the control is read-only.}
507
508\membersection{wxTextCtrl::SetInsertionPoint}\label{wxtextctrlsetinsertionpoint}
509
eaaa6a06 510\func{virtual void}{SetInsertionPoint}{\param{long}{ pos}}
a660d684 511
71777e2c 512Sets the insertion point at the given position.
a660d684
KB
513
514\wxheading{Parameters}
515
516\docparam{pos}{Position to set.}
517
518\membersection{wxTextCtrl::SetInsertionPointEnd}\label{wxtextctrlsetinsertionpointend}
519
520\func{virtual void}{SetInsertionPointEnd}{\void}
521
71777e2c
HH
522Sets the insertion point at the end of the text control. This is equivalent
523to \helpref{SetInsertionPoint}{wxtextctrlsetinsertionpoint}(\helpref{GetLastPosition}{wxtextctrlgetlastposition}()).
a660d684 524
d7eee191
VZ
525\membersection{wxTextCtrl::SetMaxLength}\label{wxtextctrlsetmaxlength}
526
527\func{virtual void}{SetMaxLength}{\param{unsigned long }{len}}
528
529This function sets the maximum number of characters the user can enter into the
530control. In other words, it allows to limit the text value length to {\it len}
531not counting the terminating {\tt NUL} character.
532
5949fba6
VZ
533If {\it len} is $0$, the previously set max length limi, if any, is discarded
534and the user may enter as much text as the underlying native text control
535widget supports (typically at least 32Kb).
536
d7eee191
VZ
537If the user tries to enter more characters into the text control when it
538already is filled up to the maximal length, a
539{\tt wxEVT\_COMMAND\_TEXT\_MAXLEN} event is sent to notify the program about it
540(giving it the possibility to show an explanatory message, for example) and the
541extra input is discarded.
542
543Note that this function may only be used with single line text controls.
544
545\wxheading{Compatibility}
546
547Only implemented in wxMSW/wxGTK starting with wxWindows 2.3.2.
548
a660d684
KB
549\membersection{wxTextCtrl::SetSelection}\label{wxtextctrlsetselection}
550
eaaa6a06 551\func{virtual void}{SetSelection}{\param{long}{ from}, \param{long}{ to}}
a660d684 552
71777e2c 553Selects the text starting at the first position up to (but not including) the character at the last position.
a660d684
KB
554
555\wxheading{Parameters}
556
557\docparam{from}{The first position.}
558
559\docparam{to}{The last position.}
560
561\membersection{wxTextCtrl::SetValue}\label{wxtextctrlsetvalue}
562
563\func{virtual void}{SetValue}{\param{const wxString\& }{ value}}
564
f6bcfd97 565Sets the text value and marks the control as not-modified.
a660d684
KB
566
567\wxheading{Parameters}
568
569\docparam{value}{The new value to set. It may contain newline characters if the text control is multi-line.}
570
571\membersection{wxTextCtrl::ShowPosition}\label{wxtextctrlshowposition}
572
eaaa6a06 573\func{void}{ShowPosition}{\param{long}{ pos}}
a660d684
KB
574
575Makes the line containing the given position visible.
576
577\wxheading{Parameters}
578
579\docparam{pos}{The position that should be visible.}
580
ca8b28f2
JS
581\membersection{wxTextCtrl::Undo}\label{wxtextctrlundo}
582
583\func{virtual void}{Undo}{\void}
584
585If there is an undo facility and the last operation can be undone, undoes the last operation. Does nothing
586if there is no undo facility.
587
a660d684
KB
588\membersection{wxTextCtrl::WriteText}\label{wxtextctrlwritetext}
589
590\func{void}{WriteText}{\param{const wxString\& }{ text}}
591
86975656 592Writes the text into the text control at the current insertion position.
a660d684
KB
593
594\wxheading{Parameters}
595
596\docparam{text}{Text to write to the text control.}
597
598\wxheading{Remarks}
599
600Newlines in the text string
601are the only control characters allowed, and they will cause appropriate
abaa2936 602line breaks. See \helpref{wxTextCtrl::\cinsert}{wxtextctrlinsert} and \helpref{wxTextCtrl::AppendText}{wxtextctrlappendtext} for more convenient ways of writing to the window.
71777e2c
HH
603
604After 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
KB
605
606\membersection{wxTextCtrl::XYToPosition}\label{wxtextctrlxytoposition}
607
eaaa6a06 608\func{long}{XYToPosition}{\param{long}{ x}, \param{long}{ y}}
a660d684 609
71777e2c 610Converts the given zero based column and line number to a position.
a660d684
KB
611
612\wxheading{Parameters}
613
71777e2c 614\docparam{x}{The column number.}
a660d684 615
71777e2c 616\docparam{y}{The line number.}
a660d684
KB
617
618\wxheading{Return value}
619
620The position value.
621
622\membersection{wxTextCtrl::operator \cinsert}\label{wxtextctrlinsert}
623
624\func{wxTextCtrl\&}{operator \cinsert}{\param{const wxString\& }{s}}
625
626\func{wxTextCtrl\&}{operator \cinsert}{\param{int}{ i}}
627
628\func{wxTextCtrl\&}{operator \cinsert}{\param{long}{ i}}
629
630\func{wxTextCtrl\&}{operator \cinsert}{\param{float}{ f}}
631
632\func{wxTextCtrl\&}{operator \cinsert}{\param{double}{ d}}
633
634\func{wxTextCtrl\&}{operator \cinsert}{\param{char}{ c}}
635
abaa2936 636Operator definitions for appending to a text control, for example:
a660d684
KB
637
638\begin{verbatim}
639 wxTextCtrl *wnd = new wxTextCtrl(my_frame);
640
641 (*wnd) << "Welcome to text control number " << 1 << ".\n";
642\end{verbatim}
643