Re: Shortcuts to buttons



HRahman10 aol com wrote:
> 
> Hi, thanks for that, but how do create a GtkAccelGroup, how do you use
> it,
> what it is it? There dosn't seem to be any documentation on it.

This is what Glade outputs, which may help:

GtkWidget*
create_window1 (void)
{
  GtkWidget *window1;
  guint button1_key;
  GtkWidget *button1;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  button1 = gtk_button_new_with_label ("");
  button1_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN
(button1)->child),
                                   _("_Start"));
  gtk_widget_add_accelerator (button1, "clicked", accel_group,
                              button1_key, GDK_MOD1_MASK,
(GtkAccelFlags) 0);
  gtk_widget_show (button1);
  gtk_container_add (GTK_CONTAINER (window1), button1);

  gtk_window_add_accel_group (GTK_WINDOW (window1), accel_group);

  return window1;
}


Damon




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