NextPrevUpTopContentsIndex

set-rich-text-pane-character-format

Function
Summary

Sets the character format.

Package

capi

Signature

set-rich-text-pane-character-format pane &key selection attributes-plist default => result

Arguments

pane

A rich-text-pane.

selection

A boolean.

attributes-plist

A plist.

default

A boolean.

Values

result

A plist.

Description

The function set-rich-text-pane-character-format sets current character attributes for pane .

selection determines the text for which the attributes are set. If selection is nil , then the attributes are set on the next text entered in pane . If selection is t , then the attributes are set on the current selection. The default value of selection is t .

attributes-plist is a plist of keywords and values. These keywords are valid on MS Windows and Cocoa:

:bold

A boolean.

:italic

A boolean.

:underline

A boolean.

:face

A string naming a font.

:color

A color spec or alias specifying the foreground color.

:size

The size of the font.

Additionally these attributes-plist keywords are valid on MS Windows only:

:strikeout

A boolean.

:offset

An integer specifying the vertical offset of characters from the line (a positive value makes them superscript and a negative value makes them subscript).

:protected

A boolean.

:charset

A cons ( charset . pitch-and-family ) where charset has the value of a Windows charset identifier, and pitch-and-family is the value of (logior pitch family ) where pitch and family have the value of a Windows pitch and a Windows font family respectively.

Example

Note: This example uses some features which are supported only on MS Windows:

(defun ok-to-edit-p (pane start end s)
  (declare (ignore pane))
  (capi:prompt-for-confirmation 
   (format nil "Editing~:[ ~; selection ~]from ~a to ~a"
           s start end)))
 
(setq rtp 
      (capi:contain 
       (make-instance 
        'capi:rich-text-pane 
        :protected-callback 'ok-to-edit-p
        :character-format 
        '(:size 14  :color :red)
        :visible-min-height 300
        :visible-min-width 400
        :paragraph-format 
        '(:start-indent 20 :offset -15)
        :text-limit 160
        :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. ~%" ))))

Enter some characters in the rich text window.

Set it all to blue:

(capi:set-rich-text-pane-character-format 
 rtp
 :attributes-plist '(:color :blue)  
 :selection nil)

Make it all protected:

(capi:set-rich-text-pane-character-format
 rtp :attributes-plist '(:protected t) :selection nil)

Now try to delete a character, and also to delete the selection. In both cases the ok-to-edit-p callback is called.

See also

rich-text-pane
rich-text-pane-character-format


LispWorks CAPI Reference Manual - 25 Jul 2006

NextPrevUpTopContentsIndex