X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4d7b7fc21217722b407320c5d599e3d316c72996..8da8907446d4b07378b8564e93c05b9e7257de15:/docs/latex/wx/text.tex diff --git a/docs/latex/wx/text.tex b/docs/latex/wx/text.tex index 8bc4647878..899204f454 100644 --- a/docs/latex/wx/text.tex +++ b/docs/latex/wx/text.tex @@ -92,8 +92,8 @@ streambuf\\ \twocolwidtha{5cm} \begin{twocollist}\itemsep=0pt \twocolitem{\windowstyle{wxTE\_PROCESS\_ENTER}}{The control will generate -the message wxEVENT\_TYPE\_TEXT\_ENTER\_COMMAND (otherwise pressing is -either processed internally by the control or used for navigation between +the message wxEVENT\_TYPE\_TEXT\_ENTER\_COMMAND (otherwise pressing Enter key +is either processed internally by the control or used for navigation between dialog controls).} \twocolitem{\windowstyle{wxTE\_PROCESS\_TAB}}{The control will receive EVT\_CHAR messages for TAB pressed - normally, TAB is used for passing to the @@ -114,14 +114,40 @@ under Win32 only and requires wxTE\_RICH.} doesn't show the selection when it doesn't have focus - use this style to force it to always show it. It doesn't do anything under other platforms.} \twocolitem{\windowstyle{wxHSCROLL}}{A horizontal scrollbar will be created. No effect under GTK+.} +\twocolitem{\windowstyle{wxTE\_LEFT}}{The text control will be left-justified (default).} +\twocolitem{\windowstyle{wxTE\_CENTRE}}{The text control will be centre-justified.} +\twocolitem{\windowstyle{wxTE\_RIGHT}}{The text control will be right-justified.} \twocolitem{\windowstyle{wxTE\_DONTWRAP}}{Same as {\tt wxHSCROLL} style.} -\twocolitem{\windowstyle{wxTE\_LINEWRAP}}{Wrap the lines too long to be shown entirely at any position (wxUniv only currently)} -\twocolitem{\windowstyle{wxTE\_WORDWRAP}}{Wrap the lines too long to be shown entirely at word boundaries only (wxUniv only currently)} +\twocolitem{\windowstyle{wxTE\_LINEWRAP}}{Wrap the lines too long to be shown entirely at any position (wxUniv only currently).} +\twocolitem{\windowstyle{wxTE\_WORDWRAP}}{Wrap the lines too long to be shown entirely at word boundaries only (wxUniv only currently).} \end{twocollist} See also \helpref{window styles overview}{windowstyles} and \helpref{wxTextCtrl::wxTextCtrl}{wxtextctrlconstr}. +\wxheading{wxTextCtrl text format} + +The multiline text controls always store the text as a sequence of lines +separated by {\tt $\backslash$n} characters, i.e. in the Unix text format even +on non-Unix platforms. This allows the user code to ignore the differences +between the platforms but at a price: the indices in the control such as those +returned by \helpref{GetInsertionPoint}{wxtextctrlgetinsertionpoint} or +\helpref{GetSelection}{wxtextctrlgetselection} can {\bf not} be used as +indices into the string returned by \helpref{GetValue}{wxtextctrlgetvalue} as +they're going to be slightly off for platforms using +{\tt $\backslash$r$\backslash$n} as separator (as Windows does), for example. + +Instead, if you need to obtain a substring between the $2$ indices obtained +from the control with the help of the functions mentioned above, you should +use \helpref{GetRange}{wxtextctrlgetrange}. And the indices themselves can +only be passed to other methods, for example +\helpref{SetInsertionPoint}{wxtextctrlsetinsertionpoint} or +\helpref{SetSelection}{wxtextctrlsetselection}. + +To summarize: never use the indices returned by (multiline) wxTextCtrl as +indices into the string it contains, but only as arguments to be passed back +to the other wxTextCtrl methods. + \wxheading{wxTextCtrl styles} Multi-line text controls support the styles, i.e. provide a possibility to set @@ -243,7 +269,8 @@ generated when the text changes. Notice that this event will always be sent when the text controls contents changes - whether this is due to user input or comes from the program itself (for example, if SetValue() is called)} \twocolitem{{\bf EVT\_TEXT\_ENTER(id, func)}}{Respond to a wxEVT\_COMMAND\_TEXT\_ENTER event, -generated when enter is pressed in a single-line text control.} +generated when enter is pressed in a text control (which must have +wxTE\_PROCESS\_ENTER style for this event to be generated).} \twocolitem{{\bf EVT\_TEXT\_URL(id, func)}}{A mouse event occured over an URL in the text control (Win32 only)} \twocolitem{{\bf EVT\_TEXT\_MAXLEN(id, func)}}{User tried to enter more text @@ -407,6 +434,9 @@ inserted if the given key event had occured in the text control. The {\it event} object should be the same as the one passed to {\tt EVT\_KEY\_DOWN} handler previously by wxWindows. +Please note that this function doesn't currently work correctly for all keys +under any platform but MSW. + \wxheading{Return value} {\tt TRUE} if the event resulted in a change to the control, {\tt FALSE} @@ -551,8 +581,9 @@ returned string is empty. \constfunc{wxString}{GetValue}{\void} Gets the contents of the control. Notice that for a multiline text control, -the lines will be separated by (Unix-style) $\backslash$n characters, even under -Windows where they are separated by a $\backslash$r$\backslash$n sequence in the native control. +the lines will be separated by (Unix-style) $\backslash$n characters, even +under Windows where they are separated by a $\backslash$r$\backslash$n +sequence in the native control. \membersection{wxTextCtrl::IsEditable}\label{wxtextctrliseditable}