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

Re: Accel group on buttons?



On Wed, Jul 07, 2004 at 10:06:50AM +0200, Radoslaw Grzanka wrote:
> (I have written to gtkmm group but no answer. Maybe here? Below code is in C++ but I will accept in C too. )
> 
> Hello,
> In my application I would like to activate buttons with
> e.g. F1 key. How do I do that? AFAIK Mnemonics can be only one printable letter (Correct me if I'm wrong).
> I fiddled around with AccelGroup of toplevel window but all I got
> was:
> Gtk-WARNING **: gtkwidget.c:3075: widget `gtkmm__GtkButton'
> has no activatable signal "F1" without arguments"
> 
> The above result is because of code:
> button->add_accelerator("F1",
> w->get_accel_group(),
> gdk_keyval_from_name( "F1"),
> Gdk::RELEASE_MASK,
> Gtk::ACCEL_MASK );
> 
> (w is toplevel window)
> 
> How do I define "activatable signal"?

There probably be a signal of the widget to emit when the
key is pressed in place of "F1", e.g. "clicked".  I'm not
sure about the C++ arguments, so here's C:

gtk_widget_add_accelerator(button,      /* widget */
                           "clicked",   /* signal */
                           accel_group, /* accel_group */
                           GDK_F1,      /* key */
                           GDK_RELEASE_MASK,  /* accel_mods */
                           0);          /* accel_flags */

You may put some particular flags there instead of 0, but
using GTK_ACCEL_MASK is not a good idea, as it has ALL the
flags set.

Yeti


--
Do not use tab characters. Their effect is not predictable.


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