scrolling a multi-line-text-input-pane
Hi again,
So I thought I'd muck around with a multi-line-text-input-pane.
On OS/X it is somewhat interesting. I can use the OS/X spelling
service, this is nice. I can use the popup menu to access font and
colour settings, but they don't do anything, which isn't nice, but I
can live with that if I have to. There don't appear to be any key
bindings (e.g. command-C for copy, etc.), but I can live with this too
if I must.
I cannot see how to scroll the text in the editor. Surely this is
possible. Here is the code:
(define-interface mltip-editor-simple ()
()
(:panes
(mltip multi-line-text-input-pane
:text "Hello World"
:reader mltip
:vertical-scroll t))
(:layouts
(window-layout row-layout '(mltip)
:reader window-layout))
(:default-initargs
:title "MLTIP"
:layout 'window-layout
:best-width 600
:best-height 400))
(defun mlti-simple ()
(let* ((text "The class text-input-pane provides a great deal of
flexibility
in its handling of the text being entered. It starts with the initial
text and caret-position specified by the arguments text
and caret-position respectively. It limits the number of
characters entered with the max-characters argument (which
defaults to nil,meaning there is nomaximum). The pane is
enabled or disabled according to the value of the enabled slot.
A completion-function can be specified which will get called
when the completion gesture is made by the user (or pressing
the Tab key) or when text-input-pane-complete-text is
called. The completion-function is called with the pane and the
text to complete and should return either nil, the completed
text or a list of candidate completions. In the latter case, the
CAPI will prompt the user for the completion they wish, and
this will become the new text.
When the text or caret-position is changed, the callback changecallback
is called with the text, the pane itself, the interface
and the caret-position. The arguments that are passed to the
change-callback can be altered by specifying the
change-callback-type (see the callbacks class for details of possible
values).
With the Motif/Lesstif implementation it is possible to check
changes that the user makes to the text-input-pane by providing
a confirm-change-function which gets passed the new
text, the pane itself, its interface and the new caret position,
and which should return non-nil if it is OK to make the
change. If nil is returned, then the pane will be unaltered
and a beep will be signalled to indicate that the new values
were invalid.
buttons specifies toolbar buttons which appear to the right of
the pane and facilitate user actions on it. This feature appears
in the Common LispWorks IDE, for example the Class box of
the Class Browser.
The allowed keys and values of the plist buttons are:")
(ed (make-instance 'mltip-editor-simple)))
(setf (text-input-pane-text (mltip ed)) text)
(format t "ed vert sb: [~A]~%" (simple-pane-vertical-scroll ed))
(display ed)))
(mlti-simple)
Cheers,
Bob
----
Bob Hutchison -- blogs at <http://www.recursive.ca/hutch/>
Recursive Design Inc. -- <http://www.recursive.ca/>