To display a lot of text, use this subwindow as the child of a frame. It is capable of loading and saving files of ASCII text, and under Open Look and Motif, the text can be edited directly.
To allow the user to edit text under Windows as well as the other platforms, either invoke an external editor or create a multi-line text item on a panel.
Under Windows, there is an extended range of functions. Some take character positions - a single integer which can identify a character position - and others take line and character numbers. If you want to use a function that takes one form, but you only have the other, you can convert between them using a function such as text-window-xy-to-position or text-window-position-to-line. Note that line and character numbers start from zero.
The following callbacks are valid for the dialog box class:
To invoke default processing, call text-window-on-char.
See also window-add-callback.
text-window-clear
text-window-copy
text-window-cut
text-window-create
text-window-discard-edits
text-window-get-contents
text-window-get-insertion-point
text-window-get-last-position
text-window-get-line-length
text-window-get-line-length
text-window-get-number-of-lines
text-window-load-file
text-window-modified
text-window-on-char
text-window-paste
text-window-position-to-char
text-window-position-to-line
text-window-remove
text-window-replace
text-window-show-position
text-window-save-file
text-window-set-editable
text-window-set-insertion-point
text-window-set-selection
text-window-write
text-window-xy-to-position
long ( text-window-clear long window-id)
Clears the contents of a text subwindow. Returns 1 if successful, 0 otherwise.
long ( text-window-copy long window-id)
Copies the selected text to the clipboard.
long ( text-window-cut long window-id)
Copies the selected text to the clipboard, then removes the selection.
long ( text-window-create long parent-id
optional long x optional long y
optional long width optional long height optional string style optional string name)
Creates a text subwindow. parent-id must be a valid frame ID.
style is a bit list of some of the following:
wxBORDER | Use this style to draw a thin border in Windows 3 (non-native implementation only). |
wxNATIVE_IMPL | Use this style to allow editing under MS Windows, albeit with a 64K limitation. |
name gives the text window a name that can be retrieved with window-get-name.
void ( text-window-discard-edits long window-id)
Discard any edits in the text window.
string ( text-window-get-contents long window-id)
Returns the window contents (to a maximum of 1000 characters).
long ( text-window-get-insertion-point long window-id)
Returns the insertion point.
long ( text-window-get-last-position long window-id)
Returns the final position in the text window.
long ( text-window-get-line-length long window-id long line-no)
Returns the length of the text at line line-no.
long ( text-window-get-line-text long window-id long line-no)
Returns the text at line-no.
long ( text-window-get-number-of-lines long window-id)
Returns the number of lines in the text window.
long ( text-window-load-file long window-id string filename)
Load the file onto the text subwindow, returning 1 for success, 0 for failure.
long ( text-window-modified long window-id)
Returns 1 if the text has been modified, 0 otherwise.
long ( text-window-on-char long panel-id long event-id)
The default implementation of the OnChar callback. Call this to pass intercepted characters through to the text window. Note that under Windows, there seems to be an intermittent GPF bug when using this and then closing the window.
long ( text-window-paste long window-id)
Pastes the text (if any) from the clipboard to the text window.
long ( text-window-position-to-char long window-id long pos)
Returns the character position (starting from zero) for the given index position.
long ( text-window-position-to-line long window-id long pos)
Returns the line number (starting from zero) for the given index position.
long ( text-window-remove long window-id long start-pos long end-pos)
Removes the text between the given span selection.
long ( text-window-replace long window-id long start-pos long end-pos string text)
Replaces the text between the given span selection with the given text.
long ( text-window-show-position long window-id long pos)
Shows the text at the given index position.
long ( text-window-save-file long window-id string filename)
Saves the text in the subwindow to the given file, returning 1 for success, 0 for failure.
long ( text-window-set-editable long window-id long editable)
Sets the window editable (editable is 1) or read-only (editable is 0).
long ( text-window-set-insertion-point long window-id long pos)
Sets the insertion point to the given index position.
long ( text-window-set-selection long window-id long start-pos long end-pos)
Sets the selection to the given span of text.
long ( text-window-write long window-id string text)
Writes the given string into the text window, at the current cursor point.
long ( text-window-xy-to-position long window-id long char-position long line)
Converts the character and line number (each starting from zero) to a position.