NextPrevUpTopContentsIndex

rich-text-pane-operation

Function
Summary

Gets and sets values and performs various operations on the pane.

Package

capi

Signature

rich-text-pane-operation pane operation &rest args => result, result2

Arguments

pane

A rich-text-pane.

operation

A keyword specifying the operation to perform.

args

The value or values to use, when the operation is setting something.

Values

result

Various, see below.

result2

Returned only for operation :get-selection , see below.

Description

The valid values of operation on MS Windows and Cocoa are:

:pastep , :cutp or :copyp

result is a boolean indicating whether it is currently possible to perform a :paste , :cut or :copy operation.

:paste , :cut , or :copy

Performs the indicated operation.

:select-all

Selects all the text.

:set-selection

args should be two integers start and end . Sets the selection to the region bounded by start (inclusive) and end (exclusive).

:get-selection

Returns as multiple values the bounding indexes of the selection. result is the start (inclusive) and result2 is the end (exclusive). If there is no selection, both values are the index of the insertion point.

:can-undo or :can-redo

result is a boolean indicating whether it is currently possible to perform an :undo or :redo operation.

:undo

Undoes the last editing operation. Note that, after typing, it is the whole input, rather than a single character, that is undone. The :undo operation may be repeated successively, to undo previous editing operations in turn.

Note: with RichEdit 1.0, :undo does not work repeatedly - it only undoes one previous editing operation. See rich-text-version

:redo

Undoes the effect of the last :undo operation. The :redo operation may be repeated successively, to cancel the effect of previous :undo operations in turn.

Note: with RichEdit 1.0, :redo does not work. See rich-text-version.

:get-modified

result is the value of a boolean modified flag. This flag can be set by the :set-modified operation. Also, editing the text sets it to true.

: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 MS Windows, only:

:get-word-wrap

Returns a value indicating the word wrap, which can be the keyword :none . result can also be the keyword :window or a CAPI printer object, meaning that the text wraps according to the width of the window or the printer.

:set-word-wrap

Sets the word wrap. The argument can be as described for :get-word-wrap , and additionally it can be the keyword :printer , meaning the current-printer.

:hide-selection

Specifies whether the selection should be hidden (not highlighted) when pane does not have the focus. The argument is a boolean.

 

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.

Examples
(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)
See also

rich-text-pane
rich-text-version


LispWorks CAPI Reference Manual - 25 Jul 2006

NextPrevUpTopContentsIndex