RE: [gtk-list] accelerator example
- From: "Damon Chaplin" <DAChaplin email msn com>
- To: <gtk-list redhat com>
- Subject: RE: [gtk-list] accelerator example
- Date: Fri, 16 Oct 1998 11:34:12 +0100
> anyone got any sample code that shows how to use accelerators properly?
> I just need one example, and I'll be ok.
This is for GTK 1.0.x. It adds an accelerator to a menu item:
GtkAcceleratorTable *accelerator_table;
accelerator_table = gtk_accelerator_table_new ();
gtk_window_add_accelerator_table (GTK_WINDOW (win_main), accelerator_table);
menuitem = gtk_menu_item_new_with_label (_("Open..."));
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC (on_project_open), NULL);
gtk_widget_install_accelerator (menuitem, accelerator_table,
"activate", 'O', GDK_CONTROL_MASK);
GTK 1.1.x is more like:
GtkAccelGroup *accel_group;
accel_group = gtk_accel_group_get_default ();
menuitem = gtk_menu_item_new_with_label (_("Open..."));
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC (on_project_open), NULL);
gtk_widget_add_accelerator (menuitem, "activate", accel_group,
'O', GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
Damon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]