* rebinding editor keys
@ 2001-07-16 10:58 Left Spin
2001-07-16 11:09 ` Mo DeJong
0 siblings, 1 reply; 2+ messages in thread
From: Left Spin @ 2001-07-16 10:58 UTC (permalink / raw)
To: sourcenav
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: rebinding editor keys
2001-07-16 10:58 rebinding editor keys Left Spin
@ 2001-07-16 11:09 ` Mo DeJong
0 siblings, 0 replies; 2+ messages in thread
From: Mo DeJong @ 2001-07-16 11:09 UTC (permalink / raw)
To: sourcenav
On Mon, 16 Jul 2001, Left Spin wrote:
> 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.
The online Man page for bind might help in this case:
http://tcl.activestate.com/man/tcl8.3.2/TkCmd/bind.htm
Also:
http://tcl.activestate.com/man/tcl8.3.2/
> 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.
Try it without all the SN stuff. Just start up a wish shell and
play around with it.
% wish
% text .t
.t
% pack .t
% bind .t <Control-r> {puts "linesperpage is [%W cget -height]"}
(Move mouse into text widget and press Ctrl-R)
linesperpage is 24
cheers
Mo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-07-16 11:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-16 10:58 rebinding editor keys Left Spin
2001-07-16 11:09 ` Mo DeJong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).