1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599
|
<HTML>
<head><title>wxTextCtrl</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxtextctrl"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx239.htm#wxtempfile"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx241.htm#wxtextdataobject"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxTextCtrl</H2>
<P>
A text control allows text to be displayed and edited. It may be
single line or multi-line.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
streambuf<BR>
<A HREF="wx56.htm#wxcontrol">wxControl</A><BR>
<A HREF="wx260.htm#wxwindow">wxWindow</A><BR>
<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><BR>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/textctrl.h><P>
<B><FONT COLOR="#FF0000">Window styles</FONT></B><P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>wxTE_PROCESS_ENTER</B>
</TD>
<TD VALIGN=TOP>
The callback function will
receive the message wxEVENT_TYPE_TEXT_ENTER_COMMAND. Note
that this will break tab traversal for this panel item under
Windows.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxTE_MULTILINE</B>
</TD>
<TD VALIGN=TOP>
The text control allows multiple lines.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxTE_PASSWORD</B>
</TD>
<TD VALIGN=TOP>
The text will be echoed as asterisks.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxTE_READONLY</B>
</TD>
<TD VALIGN=TOP>
The text will not be user-editable.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>wxHSCROLL</B>
</TD>
<TD VALIGN=TOP>
A horizontal scrollbar will be created.
</TD></TR>
</TABLE>
<P>
See also <A HREF="wx305.htm#windowstyles">window styles overview</A> and
<A HREF="wx240.htm#wxtextctrlconstr">wxTextCtrl::wxTextCtrl</A>.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
This class multiply-inherits from <B>streambuf</B> where compilers allow, allowing code such as the following:<P>
<FONT SIZE=2><PRE>
wxTextCtrl *control = new wxTextCtrl(...);
ostream stream(control)
stream << 123.456 << " some text\n";
stream.flush();
</PRE>
</FONT>If your compiler does not support derivation from <B>streambuf</B> and gives a compile error, define the symbol <B>NO_TEXT_WINDOW_STREAM</B> in the
wxTextCtrl header file.<P>
<B><FONT COLOR="#FF0000">Event handling</FONT></B><P>
To process input from a text control, use these event handler macros to direct input to member
functions that take a <A HREF="wx52.htm#wxcommandevent">wxCommandEvent</A> argument.<P>
<TABLE>
<TR><TD VALIGN=TOP>
<B>EVT_TEXT(id, func)</B>
</TD>
<TD VALIGN=TOP>
Respond to a wxEVT_COMMAND_TEXT_UPDATED event,
generated when the text changes.
</TD></TR>
<TR><TD VALIGN=TOP>
<B>EVT_TEXT_ENTER(id, func)</B>
</TD>
<TD VALIGN=TOP>
Respond to a wxEVT_COMMAND_TEXT_ENTER event,
generated when enter is pressed in a single-line text control.
</TD></TR>
</TABLE>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxtextctrlconstr">wxTextCtrl::wxTextCtrl</A><BR>
<A HREF="#topic972">wxTextCtrl::~wxTextCtrl</A><BR>
<A HREF="#wxtextctrlclear">wxTextCtrl::Clear</A><BR>
<A HREF="#wxtextctrlcopy">wxTextCtrl::Copy</A><BR>
<A HREF="#wxtextctrlcreate">wxTextCtrl::Create</A><BR>
<A HREF="#wxtextctrlcut">wxTextCtrl::Cut</A><BR>
<A HREF="#topic973">wxTextCtrl::DiscardEdits</A><BR>
<A HREF="#wxtextctrlgetinsertionpoint">wxTextCtrl::GetInsertionPoint</A><BR>
<A HREF="#wxtextctrlgetlastposition">wxTextCtrl::GetLastPosition</A><BR>
<A HREF="#wxtextctrlgetlinelength">wxTextCtrl::GetLineLength</A><BR>
<A HREF="#wxtextctrlgetlinetext">wxTextCtrl::GetLineText</A><BR>
<A HREF="#wxtextctrlgetnumberoflines">wxTextCtrl::GetNumberOfLines</A><BR>
<A HREF="#wxtextctrlgetvalue">wxTextCtrl::GetValue</A><BR>
<A HREF="#wxtextctrlismodified">wxTextCtrl::IsModified</A><BR>
<A HREF="#wxtextctrlloadfile">wxTextCtrl::LoadFile</A><BR>
<A HREF="#wxtextctrlonchar">wxTextCtrl::OnChar</A><BR>
<A HREF="#wxtextctrlondropfiles">wxTextCtrl::OnDropFiles</A><BR>
<A HREF="#wxtextctrlpaste">wxTextCtrl::Paste</A><BR>
<A HREF="#wxtextctrlpositiontoxy">wxTextCtrl::PositionToXY</A><BR>
<A HREF="#wxtextctrlremove">wxTextCtrl::Remove</A><BR>
<A HREF="#wxtextctrlreplace">wxTextCtrl::Replace</A><BR>
<A HREF="#wxtextctrlsavefile">wxTextCtrl::SaveFile</A><BR>
<A HREF="#wxtextctrlseteditable">wxTextCtrl::SetEditable</A><BR>
<A HREF="#wxtextctrlsetinsertionpoint">wxTextCtrl::SetInsertionPoint</A><BR>
<A HREF="#wxtextctrlsetinsertionpointend">wxTextCtrl::SetInsertionPointEnd</A><BR>
<A HREF="#wxtextctrlsetselection">wxTextCtrl::SetSelection</A><BR>
<A HREF="#wxtextctrlsetvalue">wxTextCtrl::SetValue</A><BR>
<A HREF="#wxtextctrlshowposition">wxTextCtrl::ShowPosition</A><BR>
<A HREF="#wxtextctrlwritetext">wxTextCtrl::WriteText</A><BR>
<A HREF="#wxtextctrlappendtext">wxTextCtrl::AppendText</A><BR>
<A HREF="#wxtextctrlxytoposition">wxTextCtrl::XYToPosition</A><BR>
<A HREF="#wxtextctrlinsert">wxTextCtrl::operator <<</A><BR>
<P>
<HR>
<A NAME="wxtextctrlconstr"></A>
<H3>wxTextCtrl::wxTextCtrl</H3>
<P>
<B></B> <B>wxTextCtrl</B>()<P>
Default constructor.<P>
<B></B> <B>wxTextCtrl</B>(<B>wxWindow* </B><I>parent</I>, <B>wxWindowID</B><I> id</I>,
<B>const wxString& </B><I>value = ""</I>, <B>const wxPoint& </B><I>pos</I>, <B>const wxSize& </B><I>size = wxDefaultSize</I>,
<B>long</B><I> style = 0</I>, <B>const wxValidator& </B><I>validator</I>, <B>const wxString& </B><I>name = "text"</I>)<P>
Constructor, creating and showing a text control.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>parent</I><UL><UL>
Parent window. Should not be NULL.</UL></UL>
<P>
<I>id</I><UL><UL>
Control identifier. A value of -1 denotes a default value.</UL></UL>
<P>
<I>value</I><UL><UL>
Default text value.</UL></UL>
<P>
<I>pos</I><UL><UL>
Text control position.</UL></UL>
<P>
<I>size</I><UL><UL>
Text control size.</UL></UL>
<P>
<I>style</I><UL><UL>
Window style. See <A HREF="wx240.htm#wxtextctrl">wxTextCtrl</A>.</UL></UL>
<P>
<I>validator</I><UL><UL>
Window validator.</UL></UL>
<P>
<I>name</I><UL><UL>
Window name.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
The horizontal scrollbar (<B>wxTE_HSCROLL</B> style flag) will only be created for multi-line text controls.
Without a horizontal scrollbar, text lines that don't fit in the control's
size will be wrapped (but no newline character is inserted). Single line
controls don't have a horizontal scrollbar, the text is automatically scrolled
so that the <A HREF="wx240.htm#wxtextctrlgetinsertionpoint">insertion point</A> is always
visible.<P>
Under Windows, if the <B>wxTE_MULTILINE</B> style is used, the window is implemented
as a Windows rich text control with unlimited capacity. Otherwise, normal edit control limits
apply.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx240.htm#wxtextctrlcreate">wxTextCtrl::Create</A>, <A HREF="wx255.htm#wxvalidator">wxValidator</A><P>
<HR>
<A NAME="topic972"></A>
<H3>wxTextCtrl::~wxTextCtrl</H3>
<P>
<B></B> <B>~wxTextCtrl</B>()<P>
Destructor, destroying the text control.<P>
<HR>
<A NAME="wxtextctrlclear"></A>
<H3>wxTextCtrl::Clear</H3>
<P>
<B>virtual void</B> <B>Clear</B>()<P>
Clears the text in the control.<P>
<HR>
<A NAME="wxtextctrlcopy"></A>
<H3>wxTextCtrl::Copy</H3>
<P>
<B>virtual void</B> <B>Copy</B>()<P>
Copies the selected text to the clipboard under Motif and MS Windows.<P>
<HR>
<A NAME="wxtextctrlcreate"></A>
<H3>wxTextCtrl::Create</H3>
<P>
<B>bool</B> <B>Create</B>(<B>wxWindow* </B><I>parent</I>, <B>wxWindowID</B><I> id</I>,
<B>const wxString& </B><I>value = ""</I>, <B>const wxPoint& </B><I>pos</I>, <B>const wxSize& </B><I>size = wxDefaultSize</I>,
<B>long</B><I> style = 0</I>, <B>const wxValidator& </B><I>validator</I>, <B>const wxString& </B><I>name = "text"</I>)<P>
Creates the text control for two-step construction. Derived classes
should call or replace this function. See <A HREF="wx240.htm#wxtextctrlconstr">wxTextCtrl::wxTextCtrl</A>
for further details.<P>
<HR>
<A NAME="wxtextctrlcut"></A>
<H3>wxTextCtrl::Cut</H3>
<P>
<B>virtual void</B> <B>Cut</B>()<P>
Copies the selected text to the clipboard and removes the selection.<P>
<HR>
<A NAME="topic973"></A>
<H3>wxTextCtrl::DiscardEdits</H3>
<P>
<B>void</B> <B>DiscardEdits</B>()<P>
Resets the internal 'modified' flag as if the current edits had been saved.<P>
<HR>
<A NAME="wxtextctrlgetinsertionpoint"></A>
<H3>wxTextCtrl::GetInsertionPoint</H3>
<P>
<B>virtual long</B> <B>GetInsertionPoint</B>() <B>const</B><P>
Returns the insertion point. This is defined as the zero based index of the
character position to the right of the insertion point. For example, if
the insertion point is at the end of the text control, it is equal to
both <A HREF="wx240.htm#wxtextctrlgetvalue">GetValue()</A>.Length() and
<A HREF="wx240.htm#wxtextctrlgetlastposition">GetLastPosition()</A>. <P>
The following code snippet safely returns the character at the insertion
point or the zero character if the point is at the end of the control.<P>
<FONT SIZE=2><PRE>
char GetCurrentChar(wxTextCtrl *tc) {
if (tc->GetInsertionPoint() == tc->GetLastPosition())
return '\0';
return tc->GetValue[tc->GetInsertionPoint()];
}
</PRE>
</FONT>
<HR>
<A NAME="wxtextctrlgetlastposition"></A>
<H3>wxTextCtrl::GetLastPosition</H3>
<P>
<B>virtual long</B> <B>GetLastPosition</B>() <B>const</B><P>
Returns the zero based index of the last position in the text control,
which is equal to the number of characters in the control.<P>
<HR>
<A NAME="wxtextctrlgetlinelength"></A>
<H3>wxTextCtrl::GetLineLength</H3>
<P>
<B>int</B> <B>GetLineLength</B>(<B>long</B><I> lineNo</I>) <B>const</B><P>
Gets the length of the specified line, not including any trailing newline
character(s).<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>lineNo</I><UL><UL>
Line number (starting from zero).</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
The length of the line, or -1 if <I>lineNo</I> was invalid.<P>
<HR>
<A NAME="wxtextctrlgetlinetext"></A>
<H3>wxTextCtrl::GetLineText</H3>
<P>
<B>wxString</B> <B>GetLineText</B>(<B>long</B><I> lineNo</I>) <B>const</B><P>
Returns the contents of a given line in the text control, not including
any trailing newline character(s).<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>lineNo</I><UL><UL>
The line number, starting from zero.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
The contents of the line.<P>
<HR>
<A NAME="wxtextctrlgetnumberoflines"></A>
<H3>wxTextCtrl::GetNumberOfLines</H3>
<P>
<B>int</B> <B>GetNumberOfLines</B>() <B>const</B><P>
Returns the number of lines in the text control buffer.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Note that even empty text controls have one line (where the insertion point
is), so GetNumberOfLines() never returns 0.<P>
For gtk_text (multi-line) controls, the number of lines is
calculated by actually counting newline characters in the buffer. You
may wish to avoid using functions that work with line numbers if you are
working with controls that contain large amounts of text.<P>
<HR>
<A NAME="wxtextctrlgetvalue"></A>
<H3>wxTextCtrl::GetValue</H3>
<P>
<B>wxString</B> <B>GetValue</B>() <B>const</B><P>
Gets the contents of the control.<P>
<HR>
<A NAME="wxtextctrlismodified"></A>
<H3>wxTextCtrl::IsModified</H3>
<P>
<B>bool</B> <B>IsModified</B>() <B>const</B><P>
Returns TRUE if the text has been modified.<P>
<HR>
<A NAME="wxtextctrlloadfile"></A>
<H3>wxTextCtrl::LoadFile</H3>
<P>
<B>bool</B> <B>LoadFile</B>(<B>const wxString& </B><I> filename</I>)<P>
Loads and displays the named file, if it exists.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>filename</I><UL><UL>
The filename of the file to load.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
TRUE if successful, FALSE otherwise.<P>
<HR>
<A NAME="wxtextctrlonchar"></A>
<H3>wxTextCtrl::OnChar</H3>
<P>
<B>void</B> <B>OnChar</B>(<B>wxKeyEvent& </B><I>event</I>)<P>
Default handler for character input.<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
It is possible to intercept character
input by overriding this member. Call this function
to let the default behaviour take place; not calling
it results in the character being ignored. You can
replace the <I>keyCode</I> member of <I>event</I> to
translate keystrokes.<P>
Note that Windows and Motif have different ways
of implementing the default behaviour. In Windows,
calling wxTextCtrl::OnChar immediately
processes the character. In Motif,
calling this function simply sets a flag
to let default processing happen. This might affect
the way in which you write your OnChar function
on different platforms.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx124.htm#wxkeyevent">wxKeyEvent</A><P>
<HR>
<A NAME="wxtextctrlondropfiles"></A>
<H3>wxTextCtrl::OnDropFiles</H3>
<P>
<B>void</B> <B>OnDropFiles</B>(<B>wxDropFilesEvent& </B><I>event</I>)<P>
This event handler function implements default drag and drop behaviour, which
is to load the first dropped file into the control.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>event</I><UL><UL>
The drop files event.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
This is not yet implemented for the GTK.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx80.htm#wxdropfilesevent">wxDropFilesEvent</A><P>
<HR>
<A NAME="wxtextctrlpaste"></A>
<H3>wxTextCtrl::Paste</H3>
<P>
<B>virtual void</B> <B>Paste</B>()<P>
Pastes text from the clipboard to the text item.<P>
<HR>
<A NAME="wxtextctrlpositiontoxy"></A>
<H3>wxTextCtrl::PositionToXY</H3>
<P>
<B>long</B> <B>PositionToXY</B>(<B>long </B><I>pos</I>, <B>long *</B><I>x</I>, <B>long *</B><I>y</I>) <B>const</B><P>
Converts given position to a zero-based column, line number pair.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>pos</I><UL><UL>
Position.</UL></UL>
<P>
<I>x</I><UL><UL>
Receives zero based column number.</UL></UL>
<P>
<I>y</I><UL><UL>
Receives zero based line number.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
Non-zero on success, zero on failure (most likely due to a too large position
parameter).<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx240.htm#wxtextctrlxytoposition">wxTextCtrl::XYToPosition</A><P>
<B><FONT COLOR="#0000C8">wxPython note:</FONT></B><BR>
In Python, PositionToXY() returns a tuple containing the x and
y values, so (x,y) = PositionToXY() is equivalent to the call described
above.<P>
<HR>
<A NAME="wxtextctrlremove"></A>
<H3>wxTextCtrl::Remove</H3>
<P>
<B>virtual void</B> <B>Remove</B>(<B>long</B><I> from</I>, <B>long</B><I> to</I>)<P>
Removes the text starting at the first given position up to (but not including)
the character at the last position.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>from</I><UL><UL>
The first position.</UL></UL>
<P>
<I>to</I><UL><UL>
The last position.</UL></UL>
<P>
<HR>
<A NAME="wxtextctrlreplace"></A>
<H3>wxTextCtrl::Replace</H3>
<P>
<B>virtual void</B> <B>Replace</B>(<B>long</B><I> from</I>, <B>long</B><I> to</I>, <B>const wxString& </B><I>value</I>)<P>
Replaces the text starting at the first position up to (but not including)
the character at the last position with the given text.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>from</I><UL><UL>
The first position.</UL></UL>
<P>
<I>to</I><UL><UL>
The last position.</UL></UL>
<P>
<I>value</I><UL><UL>
The value to replace the existing text with.</UL></UL>
<P>
<HR>
<A NAME="wxtextctrlsavefile"></A>
<H3>wxTextCtrl::SaveFile</H3>
<P>
<B>bool</B> <B>SaveFile</B>(<B>const wxString& </B><I> filename</I>)<P>
Saves the contents of the control in a text file.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>filename</I><UL><UL>
The name of the file in which to save the text.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
TRUE if the operation was successful, FALSE otherwise.<P>
<HR>
<A NAME="wxtextctrlseteditable"></A>
<H3>wxTextCtrl::SetEditable</H3>
<P>
<B>virtual void</B> <B>SetEditable</B>(<B>const bool</B><I> editable</I>)<P>
Makes the text item editable or read-only, overriding the <B>wxTE_READONLY</B>
flag.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>editable</I><UL><UL>
If TRUE, the control is editable. If FALSE, the control is read-only.</UL></UL>
<P>
<HR>
<A NAME="wxtextctrlsetinsertionpoint"></A>
<H3>wxTextCtrl::SetInsertionPoint</H3>
<P>
<B>virtual void</B> <B>SetInsertionPoint</B>(<B>long</B><I> pos</I>)<P>
Sets the insertion point at the given position.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>pos</I><UL><UL>
Position to set.</UL></UL>
<P>
<HR>
<A NAME="wxtextctrlsetinsertionpointend"></A>
<H3>wxTextCtrl::SetInsertionPointEnd</H3>
<P>
<B>virtual void</B> <B>SetInsertionPointEnd</B>()<P>
Sets the insertion point at the end of the text control. This is equivalent
to <A HREF="wx240.htm#wxtextctrlsetinsertionpoint">SetInsertionPoint</A>(<A HREF="wx240.htm#wxtextctrlgetlastposition">GetLastPosition</A>()).<P>
<HR>
<A NAME="wxtextctrlsetselection"></A>
<H3>wxTextCtrl::SetSelection</H3>
<P>
<B>virtual void</B> <B>SetSelection</B>(<B>long</B><I> from</I>, <B>long</B><I> to</I>)<P>
Selects the text starting at the first position up to (but not including) the character at the last position.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>from</I><UL><UL>
The first position.</UL></UL>
<P>
<I>to</I><UL><UL>
The last position.</UL></UL>
<P>
<HR>
<A NAME="wxtextctrlsetvalue"></A>
<H3>wxTextCtrl::SetValue</H3>
<P>
<B>virtual void</B> <B>SetValue</B>(<B>const wxString& </B><I> value</I>)<P>
Sets the text value.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>value</I><UL><UL>
The new value to set. It may contain newline characters if the text control is multi-line.</UL></UL>
<P>
<HR>
<A NAME="wxtextctrlshowposition"></A>
<H3>wxTextCtrl::ShowPosition</H3>
<P>
<B>void</B> <B>ShowPosition</B>(<B>long</B><I> pos</I>)<P>
Makes the line containing the given position visible.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>pos</I><UL><UL>
The position that should be visible.</UL></UL>
<P>
<HR>
<A NAME="wxtextctrlwritetext"></A>
<H3>wxTextCtrl::WriteText</H3>
<P>
<B>void</B> <B>WriteText</B>(<B>const wxString& </B><I> text</I>)<P>
Writes the text into the text control at the current insertion position. <P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>text</I><UL><UL>
Text to write to the text control.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
Newlines in the text string
are the only control characters allowed, and they will cause appropriate
line breaks. See <A HREF="wx240.htm#wxtextctrlinsert">wxTextCtrl::<<</A> and <A HREF="wx240.htm#wxtextctrlappendtext">wxTextCtrl::AppendText</A> for more convenient ways of writing to the window.<P>
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 <A HREF="wx240.htm#wxtextctrlsetinsertionpointend">wxTextCtrl::SetInsertionPointEnd</A> before writing.<P>
<HR>
<A NAME="wxtextctrlappendtext"></A>
<H3>wxTextCtrl::AppendText</H3>
<P>
<B>void</B> <B>AppendText</B>(<B>const wxString& </B><I> text</I>)<P>
Appends the text to the end of the text control.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>text</I><UL><UL>
Text to write to the text control.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
After the text is appended, the insertion point will be at the end of the text control. If this behaviour is not desired,
the programmer should use <A HREF="wx240.htm#wxtextctrlgetinsertionpoint">GetInsertionPoint</A> and <A HREF="wx240.htm#wxtextctrlsetinsertionpoint">SetInsertionPoint</A>.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx240.htm#wxtextctrlwritetext">wxTextCtrl::WriteText</A><P>
<HR>
<A NAME="wxtextctrlxytoposition"></A>
<H3>wxTextCtrl::XYToPosition</H3>
<P>
<B>long</B> <B>XYToPosition</B>(<B>long</B><I> x</I>, <B>long</B><I> y</I>)<P>
Converts the given zero based column and line number to a position.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>x</I><UL><UL>
The column number.</UL></UL>
<P>
<I>y</I><UL><UL>
The line number.</UL></UL>
<P>
<B><FONT COLOR="#FF0000">Return value</FONT></B><P>
The position value.<P>
<HR>
<A NAME="wxtextctrlinsert"></A>
<H3>wxTextCtrl::operator <<</H3>
<P>
<B>wxTextCtrl&</B> <B>operator <<</B>(<B>const wxString& </B><I>s</I>)<P>
<B>wxTextCtrl&</B> <B>operator <<</B>(<B>int</B><I> i</I>)<P>
<B>wxTextCtrl&</B> <B>operator <<</B>(<B>long</B><I> i</I>)<P>
<B>wxTextCtrl&</B> <B>operator <<</B>(<B>float</B><I> f</I>)<P>
<B>wxTextCtrl&</B> <B>operator <<</B>(<B>double</B><I> d</I>)<P>
<B>wxTextCtrl&</B> <B>operator <<</B>(<B>char</B><I> c</I>)<P>
Operator definitions for appending to a text control, for example:<P>
<PRE>
wxTextCtrl *wnd = new wxTextCtrl(my_frame);
(*wnd) << "Welcome to text control number " << 1 << ".\n";
</PRE>
</BODY></HTML>
|