Re: Shortcuts to buttons



HRahman10 aol com writes:
> Hi!, is it possible to add shortcuts to buttons?

Somewhat painfully. 

- create a GtkAccelGroup
- attach it to the toplevel window
- call gtk_label_parse_uline() on the label in the button, 
  with a string such as "_Foo" for the F shortcut,
  and get back the return value which is a keysym
- add an accelerator with that keysym to the accel group
  which invokes the "clicked" signal on the button

In GTK 2, this is a bit nicer:

 button = gtk_button_new_with_mnemonic ("_Foo");

And that just works.

Havoc




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