Can't select text after popup menu



I posted this question last week, but think I described it badly, so am having another go.

In my window I display some text, which I can select by dragging across it with the mouse. The background goes blue and the text is in the clipboard. So far so good.

If I then display and dismiss a popup menu, when I drag the mouse across the text the background goes grey instead of blue and the text is not in the clipboard.

So something about my popup menu is breaking my ability to select the  text.

Trouble is, I'm so new to gtk I don't know how to track this down. The books I'm working from don't help and I can't find anything in the archives.

Below are the functions that build and display the menu, and the fragment from main() that sets it all up.

Hope someone can help.
tvm
Rob Clack


static void createPopupMenu(GtkWidget *window)
{
  GtkAccelGroup  *accel_group;
  static GtkItemFactoryEntry menu_items[] = {
    {"/_Quit", "<control>Q", Quit , 0, NULL},
    {"/_Help", "<control>H", Help , 0, NULL},
    {"/_Print","<control>P", Print, 0, NULL},
  };

  gint nmenu_items = sizeof(menu_items) / (sizeof (menu_items[0]));

  accel_group = gtk_accel_group_new();

item_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<popup>", accel_group); gtk_item_factory_create_items(item_factory, nmenu_items, menu_items, NULL);
  gtk_accel_group_attach(accel_group, GTK_OBJECT(window));
}



static void ButtonPressCallback(GtkWidget *widget,
                                GdkEventButton *event,
                                gpointer callback_data)
{
  gint x, y;

  if (event->button == 3)
    {
      gdk_window_get_origin(widget->window, &x, &y);
      gtk_item_factory_popup(item_factory,
                             event->x + x, event->y + y,
                             event->button, event->time);

    }
  return;
}


int main(int argc, char *argv[])
{
.
.
.
  createPopupMenu(window);
  gtk_widget_set_events(window, GDK_BUTTON_PRESS_MASK);
  gtk_signal_connect(GTK_OBJECT(window), "button_press_event",
                     GTK_SIGNAL_FUNC(ButtonPressCallback), NULL);
.
.
.
}
--
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Just self-replicating, compartmentalised redox chemistry, really.
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Rob Clack                        Acedb Development,  Informatics Group
 email: rnc sanger ac uk                Wellcome Trust Sanger Institute
 Tel: +44 1223 494780                   Wellcome Trust Genome Campus
 Fax: +44 1223 494919                   Hinxton  Cambridge    CB10 1SA





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