Accessors

editor-pane-texteditor-pane-enablededitor-pane-fixed-fill

Description

The accessor
editor-pane-text
is provided to read and write the text in the editor buffer. The accessor
editor-pane-enabled
is used to enable and disable the editor (when it is disabled, it ignores all input from the mouse and keyboard).

The
editor-pane
stores text in buffers which are uniquely named, and so to create an
editor-pane
using an existing buffer you should pass the
buffer-name
. To create an
editor-pane
with a new buffer, pass a
buffer-name
that does not match any existing buffer. If
buffer-name
is not passed, then the
editor-pane
uses some existing buffer.

buffer-modes
allows you to specify the initial major mode and minor modes of the
editor-pane
's buffer. It should be a list of the form
(
major-mode-name
.
minor-mode-names
)
. See the
LispWorks Editor User Guide
for a description of major and minor modes in the LispWorks edtor.

Note:
buffer-modes
is used only when the CAPI creates the buffer, and not when it reuses a buffer.

If
echo-area
is non-
nil
. then an Echo Area is added.
echo-area
defaults to
nil
.

If
fixed-fill
is non-
nil
, the editor pane tries to form lines of length close to, but no more than,
fixed-fill
. It does this by forcing line breaks at spaces between words.
fixed-fill
defaults to
nil
.

Note: editor panes support GNU Emacs keys on all platforms. Addtionally on Windows and Motif, they support MS Windows keys. Additionally on Cocoa, they support Mac OS X editor keys. Exactly one style of emulation is active at any one time for each editor pane. By default, editor panes in the Common LispWorks development environment use Emacs emulation on all platforms. By default, editor panes in delivered applications use Windows emulation on Windows, and Emacs emulation on other platforms. To alter the choice of emulation, see interface-keys-style.

Compatibility Note

In LispWorks 4.4 and previous versions, editor-pane supports only fixed-width fonts. In LispWorks 5.0 and later, variable-width fonts can also be used on Windows and Motif. Specify the font via the
:font
initarg (see simple-pane).

Example

(capi:contain (make-instance 'capi:editor-pane

:text "Hello world"))

(setq ed (capi:contain

(make-instance 'capi:editor-pane

:text "Hello world"

:enabled nil)))

Note that you cannot type into the editor pane.

(capi:apply-in-pane-process

ed #'(setf capi:editor-pane-enabled) t ed)

Now you can enter text into the editor pane interactively.

You can also change the text programmatically:

(capi:apply-in-pane-process

ed #'(setf capi:editor-pane-text) "New text" ed)

In this example the callback modifies the buffer in the correct editor context so you that see the editor update immediately:

(capi:define-interface updating-editor ()

()

(:panes

(numbers capi:list-panel

:items '(1 2 3)

:selection-callback 'update-editor

:callback-type :interface

:visible-min-height '(:character 3))

(editor capi:editor-pane

:text

"Select numbers in the list above."

:visible-min-width

(list :character 35))))

(defun update-editor (interface)

(with-slots (numbers editor) interface

(editor:process-character

(list #'(setf capi:editor-pane-text)

(format nil "~R"

(capi:choice-selected-item numbers))

editor)

(capi:editor-window editor))))

(capi:display (make-instance 'updating-editor))

This example illustrates the use of
buffer-modes
to specify a major mode: