?? text.tex
字號:
\membersection{wxTextCtrl::Clear}\label{wxtextctrlclear}
\func{virtual void}{Clear}{\void}
Clears the text in the control.
Note that this function will generate a {\tt wxEVT\_COMMAND\_TEXT\_UPDATED}
event.
\membersection{wxTextCtrl::Copy}\label{wxtextctrlcopy}
\func{virtual void}{Copy}{\void}
Copies the selected text to the clipboard under Motif and MS Windows.
\membersection{wxTextCtrl::Create}\label{wxtextctrlcreate}
\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxString\& }{value = ``"}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
\param{long}{ style = 0}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = wxTextCtrlNameStr}}
Creates the text control for two-step construction. Derived classes
should call or replace this function. See \helpref{wxTextCtrl::wxTextCtrl}{wxtextctrlctor}\rtfsp
for further details.
\membersection{wxTextCtrl::Cut}\label{wxtextctrlcut}
\func{virtual void}{Cut}{\void}
Copies the selected text to the clipboard and removes the selection.
\membersection{wxTextCtrl::DiscardEdits}\label{wxtextctrldiscardedits}
\func{void}{DiscardEdits}{\void}
Resets the internal `modified' flag as if the current edits had been saved.
\membersection{wxTextCtrl::EmulateKeyPress}\label{wxtextctrlemulatekeypress}
\func{bool}{EmulateKeyPress}{\param{const wxKeyEvent\& }{event}}
This functions inserts into the control the character which would have been
inserted if the given key event had occurred in the text control. The
{\it event} object should be the same as the one passed to {\tt EVT\_KEY\_DOWN}
handler previously by wxWidgets.
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}
otherwise.
\membersection{wxTextCtrl::GetDefaultStyle}\label{wxtextctrlgetdefaultstyle}
\constfunc{const wxTextAttr\& }{GetDefaultStyle}{\void}
Returns the style currently used for the new text.
\wxheading{See also}
\helpref{SetDefaultStyle}{wxtextctrlsetdefaultstyle}
\membersection{wxTextCtrl::GetInsertionPoint}\label{wxtextctrlgetinsertionpoint}
\constfunc{virtual long}{GetInsertionPoint}{\void}
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 \helpref{GetValue()}{wxtextctrlgetvalue}.Length() and
\helpref{GetLastPosition()}{wxtextctrlgetlastposition}.
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.
{\small%
\begin{verbatim}
char GetCurrentChar(wxTextCtrl *tc) {
if (tc->GetInsertionPoint() == tc->GetLastPosition())
return '\0';
return tc->GetValue[tc->GetInsertionPoint()];
}
\end{verbatim}
}%
\membersection{wxTextCtrl::GetLastPosition}\label{wxtextctrlgetlastposition}
\constfunc{virtual wxTextPos}{GetLastPosition}{\void}
Returns the zero based index of the last position in the text control,
which is equal to the number of characters in the control.
\membersection{wxTextCtrl::GetLineLength}\label{wxtextctrlgetlinelength}
\constfunc{int}{GetLineLength}{\param{long}{ lineNo}}
Gets the length of the specified line, not including any trailing newline
character(s).
\wxheading{Parameters}
\docparam{lineNo}{Line number (starting from zero).}
\wxheading{Return value}
The length of the line, or -1 if {\it lineNo} was invalid.
\membersection{wxTextCtrl::GetLineText}\label{wxtextctrlgetlinetext}
\constfunc{wxString}{GetLineText}{\param{long}{ lineNo}}
Returns the contents of a given line in the text control, not including
any trailing newline character(s).
\wxheading{Parameters}
\docparam{lineNo}{The line number, starting from zero.}
\wxheading{Return value}
The contents of the line.
\membersection{wxTextCtrl::GetNumberOfLines}\label{wxtextctrlgetnumberoflines}
\constfunc{int}{GetNumberOfLines}{\void}
Returns the number of lines in the text control buffer.
\wxheading{Remarks}
Note that even empty text controls have one line (where the insertion point
is), so GetNumberOfLines() never returns $0$.
For wxGTK using GTK+ 1.2.x and earlier, the number of lines in a multi-line
text control is calculated by actually counting newline characters in the
buffer, i.e. this function returns the number of logical lines and doesn't
depend on whether any of them are wrapped. For all the other platforms, the
number of physical lines in the control is returned.
Also note that you may wish to avoid using functions that work with line
numbers if you are working with controls that contain large amounts of text as
this function has $O(N)$ complexity for $N$ being the number of lines.
\membersection{wxTextCtrl::GetRange}\label{wxtextctrlgetrange}
\constfunc{virtual wxString}{GetRange}{\param{long}{ from}, \param{long}{ to}}
Returns the string containing the text starting in the positions {\it from} and
up to {\it to} in the control. The positions must have been returned by another
wxTextCtrl method.
Please note that the positions in a multiline wxTextCtrl do {\bf not}
correspond to the indices in the string returned by
\helpref{GetValue}{wxtextctrlgetvalue} because of the different new line
representations ({\tt CR} or {\tt CR LF}) and so this method should be used to
obtain the correct results instead of extracting parts of the entire value. It
may also be more efficient, especially if the control contains a lot of data.
\membersection{wxTextCtrl::GetSelection}\label{wxtextctrlgetselection}
\constfunc{virtual void}{GetSelection}{\param{long*}{ from}, \param{long*}{ to}}
Gets the current selection span. If the returned values are equal, there was
no selection.
Please note that the indices returned may be used with the other wxTextctrl
methods but don't necessarily represent the correct indices into the string
returned by \helpref{GetValue()}{wxtextctrlgetvalue} for multiline controls
under Windows (at least,) you should use
\helpref{GetStringSelection()}{wxtextctrlgetstringselection} to get the selected
text.
\wxheading{Parameters}
\docparam{from}{The returned first position.}
\docparam{to}{The returned last position.}
\pythonnote{The wxPython version of this method returns a tuple
consisting of the from and to values.}
\perlnote{In wxPerl this method takes no parameter and returns a
2-element list {\tt ( from, to )}.}
\membersection{wxTextCtrl::GetStringSelection}\label{wxtextctrlgetstringselection}
\func{virtual wxString}{GetStringSelection}{\void}
Gets the text currently selected in the control. If there is no selection, the
returned string is empty.
\membersection{wxTextCtrl::GetStyle}\label{wxtextctrlgetstyle}
\func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttr\& }{style}}
Returns the style at this position in the text control. Not all platforms
support this function.
\wxheading{Return value}
{\tt true} on success, {\tt false} if an error occurred - it may also mean that
the styles are not supported under this platform.
\wxheading{See also}
\helpref{wxTextCtrl::SetStyle}{wxtextctrlsetstyle}, \helpref{wxTextAttr}{wxtextattr}
\membersection{wxTextCtrl::GetValue}\label{wxtextctrlgetvalue}
\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.
\membersection{wxTextCtrl::HitTest}\label{wxtextctrlhittest}
\constfunc{wxTextCtrlHitTestResult}{HitTest}{\param{const wxPoint\& }{pt}, \param{wxTextCoord }{*col}, \param{wxTextCoord }{*row}}
This function finds the character at the specified position expressed in
pixels. If the return code is not \texttt{wxTE\_HT\_UNKNOWN} the row and column
of the character closest to this position are returned in the \arg{col} and
\arg{row} parameters (unless the pointers are {\tt NULL} which is allowed).
Please note that this function is currently only implemented in wxUniv,
wxMSW and wxGTK2 ports.
\wxheading{See also}
\helpref{PositionToXY}{wxtextctrlpositiontoxy}, \helpref{XYToPosition}{wxtextctrlxytoposition}
\perlnote{In wxPerl this function takes only the position argument and
returns a 3-element list \texttt{(result, col, row)}}.
\membersection{wxTextCtrl::IsEditable}\label{wxtextctrliseditable}
\constfunc{bool}{IsEditable}{\void}
Returns {\tt true} if the controls contents may be edited by user (note that it
always can be changed by the program), i.e. if the control hasn't been put in
read-only mode by a previous call to
\helpref{SetEditable}{wxtextctrlseteditable}.
\membersection{wxTextCtrl::IsModified}\label{wxtextctrlismodified}
\constfunc{bool}{IsModified}{\void}
Returns {\tt true} if the text has been modified by user. Note that calling
\helpref{SetValue}{wxtextctrlsetvalue} doesn't make the control modified.
\wxheading{See also}
\helpref{MarkDirty}{wxtextctrlmarkdirty}
\membersection{wxTextCtrl::IsMultiLine}\label{wxtextctrlismultiline}
\constfunc{bool}{IsMultiLine}{\void}
Returns {\tt true} if this is a multi line edit control and {\tt false}
otherwise.
\wxheading{See also}
\helpref{IsSingleLine}{wxtextctrlissingleline}
\membersection{wxTextCtrl::IsSingleLine}\label{wxtextctrlissingleline}
\constfunc{bool}{IsSingleLine}{\void}
Returns {\tt true} if this is a single line edit control and {\tt false}
otherwise.
\wxheading{See also}
\helpref{IsMultiLine}{wxtextctrlissingleline}
\membersection{wxTextCtrl::LoadFile}\label{wxtextctrlloadfile}
\func{bool}{LoadFile}{\param{const wxString\& }{ filename}}
Loads and displays the named file, if it exists.
\wxheading{Parameters}
\docparam{filename}{The filename of the file to load.}
\wxheading{Return value}
{\tt true} if successful, {\tt false} otherwise.
% VZ: commenting this out as: (a) the docs are wrong (you can't replace
% anything), (b) wxTextCtrl doesn't have any OnChar() anyhow
%% \membersection{wxTextCtrl::OnChar}\label{wxtextctrlonchar}
%%
%% \func{void}{OnChar}{\param{wxKeyEvent\& }{event}}
%%
%% Default handler for character input.
%%
%% \wxheading{Remarks}
%%
%% 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 {\it keyCode} member of {\it event} to
%% translate keystrokes.
%%
%% 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.
%%
%% \wxheading{See also}
%%
%% \helpref{wxKeyEvent}{wxkeyevent}
\membersection{wxTextCtrl::MarkDirty}\label{wxtextctrlmarkdirty}
\func{void}{MarkDirty}{\void}
Mark text as modified (dirty).
\wxheading{See also}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -