Getting a accelerator on a menuitem
- From: Jon Wilson <sendmemymail bigfoot com>
- To: gtk-list gnome org
- Subject: Getting a accelerator on a menuitem
- Date: Sun, 13 Apr 2003 00:33:42 +0100
I have the following code...
GtkWidget* menuBar=gtk_menu_bar_new();
gtk_widget_show(GTK_WIDGET(menuBar));
GtkWidget* exitItem;
GtkWidget* fileItem;
GtkWidget *fileMenu;
fileItem = gtk_menu_item_new_with_label ("File");
fileMenu=gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(fileItem),fileMenu);
exitItem=gtk_menu_item_new_with_label("Exit");
gtk_signal_connect_object(GTK_OBJECT(exitItem),"enter_notify_event",GTK_SIGNAL_FUNC(exit_enter_notify_event),NULL);
gtk_signal_connect_object(GTK_OBJECT(exitItem),"leave_notify_event",GTK_SIGNAL_FUNC(leave_notify_event),NULL);
gtk_signal_connect_object(GTK_OBJECT(exitItem),"activate",GTK_SIGNAL_FUNC(eventDestroy),NULL);
gtk_menu_append(GTK_MENU(fileMenu),exitItem);
gtk_menu_bar_append(GTK_MENU_BAR(menuBar),fileMenu);
gtk_widget_show(exitItem);
gtk_widget_show (fileItem);
And I want to add a accelerator to the menu.
I want to be able to use Alt-F to open the file menu and Alt-X to select
the exit option. However, I cannot seem to find a way of doing it.
I don't want to use a factory if I can help it. Can you suggest how I
can do this?
Thanks.
Jon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]