help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Keysym Fix and Transcript Keybindings


From: Daniel A. Koepke
Subject: [Help-smalltalk] Keysym Fix and Transcript Keybindings
Date: Sun, 15 Sep 2002 05:29:36 -0700 (PDT)

While attempting to add keyboard shortcuts for evaluating code in the 
Transcript, I ran into the fact that 'Ctrl-' is not a valid modifier in 
Tcl/Tk 8.3.  I'm not familiar with Tcl/Tk, so I don't know if it was 
recently changed, but the proper modifier appears to be 'Control-'.  I 
modified BEventTarget>>#getKeyPressEventName: accordingly:

+    (mod = 'Control') & (platform == #macintosh) ifTrue: [ mod ;= 'Cmd' ].
+    (mod = 'Ctrl') & (platform ~~ #macintosh) ifTrue: [ mod := 'Control' ].

I chose to map 'Ctrl-' to 'Control-' on the off-chance that some existing
code uses 'Ctrl-'.

After this change, I added PText>>#doLine:

  doLine
      "Select the current line, exec it, and deselect."
      | endPt |
      endPt := Point x: 1 y: blox currentLine.
      blox selectFrom: (Point x: 1 y: (blox currentLine - 1)) to: endPt.
      self eval.
      blox selectFrom: endPt to: endPt

and then registered the key event in the #openWorkSheet:withText: message 
of BrowserShell:

    worksheet blox onKeyEvent: 'Ctrl-Return' send: #doLine to: textView.

It might be worthwhile to add other keybindings, specifically for Accept
in the browser.  And perhaps Ctrl-1 through Ctrl-3 for opening a
Worksheet, the Class Browser, and the Namespace Browser respectively.

Unfortunately, BLOX passes through the Return _before_ #doLine is called,
which means I have to have my cursor positioned at the end of the line for
#doLine to function.  Is there a way to prevent BLOX from reading the
Return in the Ctrl-Return sequence?  I'd like to be able to hit doLine at
the beginning, middle, or end of a line, eventually.  (But I'd also like
to keep the binding as Ctrl-Return.)

Thanks,

-dak





reply via email to

[Prev in Thread] Current Thread [Next in Thread]