rebinding editor keys

Left Spin leftspin@hotmail.com
Mon Jul 16 10:58:00 GMT 2001


I'm new to Tcl/Tk. I'm rebinding keystrokes for a text widget in Source 
Navigator.

I'm trying to bind <Control-R> to a page up script.

At first I tried

proc sn_rc_editor {view text} {

  # PAGE UP
  #
  bind $text <Control-r> {
    set linesperpage [eval %W cget -height]

    %W mark set insert "insert -$linesperpage lines"
    %W see insert
    break
  }
}

but I found that $linesperpage was not correct after resizing the window. 
Then I tried

proc sn_rc_editor {view text} {

  # PAGE UP
  #
  bind ${text} <Control-r> [bind ${text} <pageup>]
}

I have to admit I don't understand how this bind syntax works. I found it in 
some of the Source Navigator source code.
I was thinking that maybe I could just map the keystroke to the already 
defined page up functionality.

Thanks for your help.

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com



More information about the Sourcenav mailing list