Re: [gtk-list] Keyboard input problem (newbie alert)



On Wed, 25 Mar 1998, Bill Thorson wrote:

> 
> Help!
> 
> I am playing with a small calculator project to help me learn gtk+.  I
> would like to have keyboard input available for the digits and operators
> as well as buttons.  I guess I don't understand how this works and cannot
> get just plain keystrokes to work.   Here is a modification to the
> helloworld program (from tutorial) which I tried:
> 
>   atbl = gtk_accelerator_table_new();
>   gtk_widget_install_accelerator(button,atbl,"clicked",
>      GDK_B,GDK_KEY_RELEASE_MASK);

you need to add the accelerator table to the toplevel window as well:
gtk_window_add_accelerator_table(window,atbl);

> 
> I thought that this would have the keyboard "B"  click the one and only
> button.  Or at least call the same callback.  Nope!  Didn't work.  Any
> ideas?
> 
> I also read about key_snooper or something like that.  What is that?
> Is that a better method for my purposes?

using the accelerator table is perfectly valid.

> 
> Bill
> 

---
ciaoTJ



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