[plt-scheme] getting to grips with keymaps

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sun Jul 27 08:37:16 EDT 2008

There's nothing wrong per se. It is just that there is a bunch of work
that going into translating the callback in on-local-char into a call
into the keymap that, I'm guessing, you don't want to duplicate.

Robby

On Sat, Jul 26, 2008 at 11:28 PM, Martin DeMello
<martindemello at gmail.com> wrote:
> Thanks! set-keymap is what I was missing, because I was looking in the
> Keymap.html and Editor.html docs rather than the editor<%> docs. I
> couldn't figure out how to add a keymap to an editor.
>
> What's the problem with on-local-char?
>
> martin
>
> On Sat, Jul 26, 2008 at 9:07 PM, Robby Findler <robby at cs.uchicago.edu> wrote:
>> Using on-local-char is probably not the way you want to do this, but
>> you wouldn't need t ochange what is below (unless you wanted to map
>> those keys in the keymap).
>>
>> Did you find the keymap% class and the set-keymap method of the
>> editor? If so, is there something specifically that was confusing? (I
>> know there is no entry in the guide for keymaps.) Try reading the
>> map-function and add-function methods' documentation.
>>
>> hth,
>> Robby
>>
>> On Sat, Jul 26, 2008 at 10:51 PM, Martin DeMello
>> <martindemello at gmail.com> wrote:
>>> I've reached the point where I need to add keymaps to my text editor,
>>> and I'm having trouble knowing where to start. (I tried reading
>>> through the drscheme sources, but that's a lot to bite off at once,
>>> and the documentation is more reference than tutorial). Specifically,
>>> I have a list of editable-text% objects (editable-text% subclasses
>>> text%) and a list of editor-snip% objects, each holding an
>>> editable-text%.
>>>
>>> Where in all that would I add a keymap, and how? Also, my
>>> editable-text% class has the following chunk of code:
>>>
>>>    (define/override (on-local-char key)
>>>      (let ([code (send key get-key-code)])
>>>        (cond [(and (equal? code 'down) (last-line?)) (next-editor) ]
>>>              [(and (equal? code 'up) (first-line?)) (prev-editor) ]
>>>              [else (super on-local-char key)])))
>>>
>>> would I need to remove that and integrate it with the keymap instead?
>>>
>>> martin
>>> _________________________________________________
>>>  For list-related administrative tasks:
>>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>>
>>>
>>
>
>


Posted on the users mailing list.