[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parallel text dialog items
- To: info-mcl
- Subject: Re: parallel text dialog items
- From: mcdougal@cs.uchicago.edu (Tom McDougal)
- Date: 11 Nov 92 20:36:52 GMT
- Newsgroups: comp.lang.lisp.mcl
- Organization: Univ. of Chicago Computer Science
- References: <1992Nov9.170736.5118@midway.uchicago.edu>
- Sender: news@uchinews.uchicago.edu (News System)
First, there was a biiiig mistake in my original code, which
should have been obvious. See if you can spot it:
>> (defclass twin-text-item (aligned-text-dialog-item)
>> ((brother :accessor brother :initarg :brother
>> :type 'text-edit-dialog-item)))
>>
>> (defmethod key-event-handler :after ((self twin-text-item) char)
>> (key-event-handler (brother self) char))
See it? 'key-event-handler' should have been
'view-key-event-handler'.
Given that correction, the code above works for instances of
editable-text-dialog-item, but not for instances of
text-edit-dialog-item (defined in the examples folder). In the latter
case, duplicates of each keystroke end up going to the same view.
Why?
It seems as though keystrokes are always handled by the window's
key-event-handler. So the following correction works:
(defmethod view-key-event-handler :after ((self twin-text-item) char)
; change the window's key event handler to BROTHER's handler
(set-key-event-handler (view-container self)
(key-event-handler (brother self)))
; process the keystroke again
(view-key-event-handler (brother self) char)
; restore SELF's handler as window's key event handler
(set-key-event-handler (view-container self) (key-event-handler
self)))
All suggestions have involved using editable-text-dialog-items, which
I will use if necessary, but the whole reason for going to text-edit-
dialog-items was to avoid the extra bulk of fred dialog items.
Anyway, thanks for the tips.
----------------------------------------------------------------------
-Tom McDougal mcdougal@cs.uchicago.edu (312) 702-0024
Dept. of Computer Science, University of Chicago
1051, Lady Godiva puts everything she has
on a horse. Citizens of Coventry place bets
for Godiva to show.