CLIM mail archive
[Prev][Next][Index][Thread]
Re: help for editing text.
Date: Mon, 28 Sep 1992 09:22 EDT
From: Jeff Morrill <jmorrill@BBN.COM>
I was trying to modify your code below to accept multi-line input.
In theory, changing the activation character from #\newline to
something like #\control-d should work, right? Well, it let
me enter multiple lines, but control-d was ignored. Any clues?
This works for me in CLIM 2.0. It should be easy for you to hack it
for CLIM 1.1 (I hope!)
(defun pop-up-text-editor (&key initial-contents prompt
(exit-gesture '(:end))
(width '(60 :character)) (height '(10 :line)))
(with-menu (stream)
;; First set up the pop-up window the way we want to see it
(setf (cursor-visibility (stream-text-cursor stream)) :off)
(when prompt
(with-text-face (stream :italic)
(write-string prompt stream))
(fresh-line stream))
(let ((width (process-spacing-arg stream width 'pop-up-text-editor :width))
(height (process-spacing-arg stream height 'pop-up-text-editor :height)))
(window-set-inside-size stream width height))
(setf (stream-text-margin stream) (bounding-rectangle-width (window-viewport stream)))
(window-expose stream)
;; Now edit the text
(unwind-protect
(do-text-editing stream
:initial-contents initial-contents :exit-gesture exit-gesture)
(setf (window-visibility stream) nil)
(setf (cursor-visibility (stream-text-cursor stream)) nil))))
(defun do-text-editing (stream &key initial-contents (exit-gesture '(:end)))
(with-input-editing (stream :initial-contents initial-contents)
(with-activation-gestures (exit-gesture :override t)
(unwind-protect
(read-token stream)
;; Eat the activation character
(read-gesture :stream stream :timeout 0)))))
0,,
Follow-Ups:
References:
Main Index |
Thread Index