Re: [gtk-list] trapping entry key-presses



//
//Is there any way to not allow some Key-Press events through to an
//Entry widget?  I'd like to use an entry, but I need to filter what
//characters are allowed in the Entry box.  Also, is it possible to
//right justify the contents of an entry?

As for filtering the characters, here's what you do: You connect to the key 
press signal and end up in the queue of handlers _before_ the entry box' 
handler. (Since the key_press_event signal is created in gtkwidget.c with 
GTK_RUN_LAST, you don't have to do anything special for that. Just 
gtk_signal_connect.) Then, if it's a key you don't like, stop the emission of 
the signal (gtk_signal_emit_stop_by_name). And hey, presto, the entry box will 
never see it. (Right, wizards?)

//Dave

Johannes.
--
"If we aren't supposed to eat animals, why are they made of meat?" -Lars Petrus

How do I connect to that real-life thing I keep hearing about?




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