[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Most elegant way to 'reroute' Text widget events?

Kenneth McDonald

9/2/2008 2:38:00 AM

After a couple of unsuccessful experiments, I'm afraid it's time to
ask the group. What I want to do is to use the text widget for
display, but to have keyboard events processed solely by Ruby. I've so
far been unsuccessful in unbinding any of the text widget's built-in
functionality, and don't want to go in and modify text.tcl, as that
strikes me as highly inelegant. I'm assuming that somehow I need to
(1) unbind the text widget I'm using from all events, and then (2)
bind all key events to (say) the top-level window. Unfortunately, my
attempts at this have met with little success. (None). Could some Tk-
fu master point me in the right direction? (At the moment, I simply
can't get things unbound from the text widget; I thought
text.bindtags([]) might work, but it didn't.)

Many thanks,
Ken

2 Answers

Hidetoshi NAGAI

9/2/2008 3:30:00 AM

0

From: Kenneth McDonald <kenneth.m.mcdonald@sbcglobal.net>
Subject: Most elegant way to 'reroute' Text widget events?
Date: Tue, 2 Sep 2008 11:37:33 +0900
Message-ID: <938E7663-22BD-4106-BECF-B7C405CF44E7@sbcglobal.net>
> strikes me as highly inelegant. I'm assuming that somehow I need to
> (1) unbind the text widget I'm using from all events, and then (2)
> bind all key events to (say) the top-level window. Unfortunately, my
> attempts at this have met with little success. (None). Could some Tk-
> fu master point me in the right direction? (At the moment, I simply
> can't get things unbound from the text widget; I thought
> text.bindtags([]) might work, but it didn't.)

Probably, the most simple way is
---------------------------------
text.bindtags -= [TkText]
---------------------------------
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Kenneth McDonald

9/2/2008 3:48:00 AM

0

Hidetoshi,

Thanks for all your help, it's been great. I would never have figured
out that
one--I'm trying to translate too literally from Tcl.

Ken


On Sep 1, 2008, at 10:29 PM, Hidetoshi NAGAI wrote:

> From: Kenneth McDonald <kenneth.m.mcdonald@sbcglobal.net>
> Subject: Most elegant way to 'reroute' Text widget events?
> Date: Tue, 2 Sep 2008 11:37:33 +0900
> Message-ID: <938E7663-22BD-4106-BECF-B7C405CF44E7@sbcglobal.net>
>> strikes me as highly inelegant. I'm assuming that somehow I need to
>> (1) unbind the text widget I'm using from all events, and then (2)
>> bind all key events to (say) the top-level window. Unfortunately, my
>> attempts at this have met with little success. (None). Could some Tk-
>> fu master point me in the right direction? (At the moment, I simply
>> can't get things unbound from the text widget; I thought
>> text.bindtags([]) might work, but it didn't.)
>
> Probably, the most simple way is
> ---------------------------------
> text.bindtags -= [TkText]
> ---------------------------------
> --
> Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
>