menu accel conflict with entry

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

 



Hi,

I'm a newbie trying to add an entry box in the same
window with a menu with accel keys.  I've found that
when I type into the text entry box, I can't enter letters
used by the menu.  How do I make the entry box
have priority over the menu when it is selected?
The file below demonstrates my problem... I can't
enter an 'n' into the entry box.

Another question about menu accel... how do I make
the menu show lower case letters when the accel key
is lower case?

Thanks...

          David


#include <stdio.h>
#include <gtk/gtk.h>

void myAction(GtkAction *action,
             gpointer   user_data)
{
 printf("Hi\n");
}

int main(int argc, char *argv[])
{
 gtk_init(&argc, &argv);

 GtkWidget *window;
 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 GtkWidget *vbox;
 vbox = gtk_vbox_new(FALSE, 0);
 gtk_container_add (GTK_CONTAINER(window), vbox);

 static GtkActionEntry entries[] = {
   { "FileMenu", NULL, "_File" },
   { "New", GTK_STOCK_NEW, "_New", "n", NULL, G_CALLBACK (myAction) },
 };

 static const gchar *ui_info =
   "<ui>\n"
   "  <menubar name='MenuBar'>\n"
   "    <menu action='FileMenu'>\n"
   "      <menuitem action='New'/>\n"
   "    </menu>\n"
   "  </menubar>\n"
   "</ui>";
 GtkUIManager *manager;
 GtkActionGroup *actions;
 actions = gtk_action_group_new ("Actions");
gtk_action_group_add_actions (actions, entries, G_N_ELEMENTS (entries), NULL);
 manager = gtk_ui_manager_new ();
 GError *err;
 err = NULL;
 gtk_ui_manager_add_ui_from_string (manager, ui_info, -1, &err);
 gtk_ui_manager_insert_action_group (manager, actions, 0);
 gtk_window_add_accel_group (GTK_WINDOW (window),
                             gtk_ui_manager_get_accel_group (manager));
 GtkWidget *mw = gtk_ui_manager_get_widget (manager, "/MenuBar");
 gtk_box_pack_start (GTK_BOX (vbox),
                     mw,
                     FALSE, FALSE, 0);
 GtkWidget *entry = gtk_entry_new();
 gtk_box_pack_start(GTK_BOX(vbox), entry, TRUE, TRUE, 0);
 gtk_widget_show_all(window);
 gtk_main();

}

_________________________________________________________________
All-in-one security and maintenance for your PC.  Get a free 90-day trial! http://clk.atdmt.com/MSN/go/msnnkwlo0050000001msn/direct/01/?href=http://www.windowsonecare.com/?sc_cid=msn_hotmail

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux