Gets and sets values and performs various operations on a pane.
capi
rich-text-pane-operation pane operation &rest args => result, result2
pane⇩ | |
operation⇩ |
A keyword specifying the operation to perform. |
args⇩ |
The value or values to use, when the operation is setting something. |
result⇩ |
Various, see below. |
result2⇩ |
Returned only for operation :get-selection , see below. |
The function rich-text-pane-operation
gets and sets values and performs various operations on pane.
The valid values of operation on Microsoft Windows and Cocoa are:
:pastep , :cutp or :copyp | |
:paste , :cut , or :copy | |
Performs the indicated operation. | |
:select-all |
Selects all the text. |
:set-selection | |
:get-selection | |
:can-undo or :can-redo | |
:undo |
Undoes the last editing operation. Note that, after typing, it is the whole input, rather than a single character, that is undone. The
Note: with RichEdit 1.0, |
:redo |
Undoes the effect of the last
Note: with RichEdit 1.0, |
:get-modified | |
:set-modified |
Sets the modified flag. The argument is a boolean. |
:save-file |
Saves the text to a file. Details below. |
:load-file |
Loads the text from a file. Details below. |
Additionally these values of operation are valid on Microsoft Windows, only:
:get-word-wrap | |
:set-word-wrap |
Sets the word wrap. The argument can be as described for |
:hide-selection |
For operations :save-file
and :load-file
, args is a lambda list:
filename &key selection format plain-text
filename is the file to save or load.
selection is a boolean, with default value nil
.
format is nil
or a keyword naming the file format. Values include :rtf
and :text
meaning Rich Text Format and text file respectively.
plain-text is a boolean, with default value nil
.
With operation :save-file
, if selection is true, only the current selection is saved. If selection is nil
, all the text is saved. The default value of format is :rtf
and there are two further allowed values, :rtfnoobjs
and :textized
. These are like :rtf
and :text
except in the way they deal with COM objects. See the documentation for SF_RTFNOOBJS and SF_TEXTIZED in the EM_STREAMOUT entry in the MSDN for details. When saving with format :rtf
or :rtfnoobjs
, if plain-text is true, then keywords that are not common to all languages are ignored. With other values of format, plain-text has no effect.
With operation :load-file
, if selection is true, the unselected text is preserved. If there is a selection, the new text replaces it. If there is no selection, the new text is inserted at the current insertion point. If selection is nil
, all the text is replaced. The default value of format is nil
, meaning that the RTF signature is relied upon to indicate a Rich Text Format file. If plain-text is true, then keywords that are not common to all languages are ignored.
(setq rtp (capi:contain (make-instance 'capi:rich-text-pane :text (format nil "First paragraph.~%Second paragraph, a little longer.~%Another paragraph, which should be long long enough that it spans more than one line. ~%" ))))
Set the selection to characters 9 to 18:
(capi:rich-text-pane-operation rtp :set-selection 9 18)
Write all the text to a file in text format:
(capi:rich-text-pane-operation rtp :save-file "mydoc.txt" :format :text)
Paste:
(capi:rich-text-pane-operation rtp :paste)
CAPI User Guide and Reference Manual (Macintosh version) - 01 Dec 2021 19:31:27