From: Masao M. <mu...@hi...> - 2002-08-20 13:21:43
|
Hi, Tom, Maybe, you have solved this problem already. On 15 Aug 2002 00:15:15 -0600 Tom Sawyer <tra...@tr...> wrote: > hi Masao, > > this doesn't seem to help. i add accelerator to an entry field assigning > Key to 'Return' and Signal to 'button_press_event'. i get this warning: > > Gtk-WARNING **: gtk_accel_group_add(): signal "button_press_event" in > the 'GtkEntry' class ancestrycannot be used as accelerator signal. At first, Accelerators and signal are different. Is it OK? IMO, You can connect signal to Gtk::Entry, but you can not define accelerator to Gtk::Entry. #This is just my opinion, but it may be something wrong ... If you get event when Return key is pressed on Gtk::Entry, You have to define signal key_press_event. 1. Select Gtk::Entry 2. Open Properies dialog and select Signals tab. 3. Signal -> key_press_event, handler -> on_xxxxx_key_press_event(automaticaly) 4. Save data. 5. in your ruby script, define on_xxxxxx_key_press_event(xxxxx is your Gtk::Entry's name) ex) class Test def initialize GladeXML.new("test.glade") {|handler| method(handler) } end def on_xxxxxx_key_press_event(widget, event, data) if Gdk::GDK_Return == event.keyval p "OK!" else p "NG!" end end : : : : end > i am confused on how to catch this signal in my code anyhow. basicaly, i > want it it act like the user hit a certain menuitem when they hit Enter. > Hmm, I don't know what you want .... . Please tell me detail. But.... Menu has deferent way to add handlers. 1. On Menu, Do Right-click and select "Edit Menu". 2. Add menus. You define some attributes. Cheers, Masao. -- .:% Masao Mutoh<mu...@hi...> |