Why isn't a POPUP containing a gtk_entry handling events?




While trying to figure out how to handle overlaying an entry widget on
a CList, I discovered that a GTK_WINDOW_POPUP containing a gtk_entry
wouldn't accept any keypress, or generate any focus_out, etc. events.

The simple program below demonstrates the problem.  I figured this
would pop up an entry widget transient that you could type in, but you
can't.  I'm sure it's something I'm doing wrong wrt focus
handling/grabbing, but I don't know what.  I tried adding code to call
gtk_widget_set_events to make sure the events were enabled, but with
no luck.

  #include <gtk/gtk.h>

  int
  main(int argc, char *argv[]) {
    GtkWidget *win;
    GtkWidget *entry;

    gtk_init(&argc, &argv);

    win = gtk_window_new (GTK_WINDOW_POPUP);
    entry = gtk_entry_new();
    gtk_container_add(GTK_CONTAINER(win), entry);
    gtk_widget_show(entry);
    gtk_entry_set_text(GTK_ENTRY(entry), "simple-test");
    gtk_widget_set_uposition (win, 20, 20);
    gtk_widget_set_usize(entry, 120, 20);
    gtk_widget_show (win);
    gtk_main();
    return 0;
  }

Thanks.

-- 
Rob Browning <rlb@cs.utexas.edu>
PGP fingerprint = E8 0E 0D 04 F5 21 A0 94  53 2B 97 F5 D6 4E 39 30



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