[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: DANNY@FARALLON.COM
- Subject: Re- View-Key-Event-Handler
- From: STEVE.M@AppleLink.Apple.COM (Aladdin Systems,Steven Mitchell,PRT)
- Date: 14 Feb 92 09:07 GMT
- Cc: INFO-MCL@CAMBRIDGE.APPLE.COM
To: Danny Brewer email@example.com
From: Steve Mitchell
> I'm having trouble fully understanding VIEW-KEY-EVENT-HANDLER....
> what if one of my subviews isn't an editable dialog item, yet
> I want it to get keystrokes? For example:
> (DEFCLASS MyView (DIALOG-ITEM) ()
> (:DEFAULT-INITARGS :VIEW-POSITION #@(10 10) :VIEW-SIZE #@(50 50)))
> How do I get the view to get keystrokes? How can I make it a key
> handler? How do I add it to the list of key handlers for the window?
Your item must inherit from key-handler-mixin:
(DEFCLASS MyView (key-handler-mixin DIALOG-ITEM) ()
(:DEFAULT-INITARGS :VIEW-POSITION #@(10 10) :VIEW-SIZE #@(50 50)))
(The superclasses must be specified in this order). Now your example
works as you intended. You could base your item on the predefined class
ccl::basic-editable-text-dialog-item, which itself has these superclasses.
> I sure would like to understand the entire mechanism better.
I'll bet you do now. Isn't CLOS beautiful? If you want to go further and
create key-receiving items that are editable, see the example file
text-edit-dialog-item.lisp, which does exactly that.