advice wanted on controlling GtkEntry input filtering



Hi all; I guess to start with, you should look at the drafting program
I'm writing at www.efalk.org/Xdraft/dr2.gif so you know what I'm talking
about.

First thing I'm trying to do is control what characters a GtkEntry widget
responds to.  As you can see, there are four GtkEntrys in the picture
and they only display numbers.  I would like to arrange for them to
completely ignore alphabetic characters.  The tutorials give methods for
changing the contents of entries after the user has typed stuff in, but
that's not good enough.  The reason is that there are several unmodified
keys being used as accelerators (e.g. "x", "y", etc.) and I want the
accelerators to work even when the GtkEntry widgets have keyboard focus.

Is there a way to do this without subclassing the GtkEntry widget and
rewriting its gtk_entry_key_press() function?

(I tried connecting a callback to the GtkEntry's "event"
signal and returning True, but that didn't work.  I tried calling
gtk_signal_emit_stop(), but that worked too well, keeping the keystroke
from reaching the accelerators either.)


Secondly, I'm trying to restrict which widgets can receive keyboard focus.
In essense, I want the tab key to move focus only between the four entry
widgets.  Is there a way to explicitly control traversal order or do I
have to clear GTK_CAN_FOCUS on every other widget in the program?


I've thought of an alternative way to handle the problem:  Is there a
way to rig the DrawingArea so that it grabs keyboard focus and holds it
permanently, and then sends select characters to the current GtkEntry
widget?




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