Re: Tk text, unset default bindings
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: Tk text, unset default bindings

From: Bryan Oakley <oakley@bardo.clearlight.com>
Date: Tue Feb 28 2006 - 13:17:41 CET

Eckhard Lehmann wrote:
> Hello,
>
> Tk's text widget, and hence ctext as well, has several default bindings
> - e.g. <Control-o> inserts a new line, <Control-v> moves the page
> forward on Unix and pastes text on the insertion cursor on windows...
>
> Is it possible to unset and redefine these default bindings somehow? I
> like to have <Control-v> bound to paste text, no matter what platform I
> am on, and I don't want to have <Control-o> to insert a new line but to
> call a different procedure (namely to open a file).
> How can I achieve this?

# add your own binding and prevent class bindings from firing:
bind .text <Control-v> {doSomething; break}
bind .text <Control-o> {doSomething; break}

# remove class binding completely:
bind Text <Control-v> {}
bind Text <Control-o> {}

If you want to remove *all* class bindings, remove Text from the
bindtags for the widget.
Received on Sun Apr 30 02:17:44 2006