Menu popup bug?
- From: Gustavo Joćo Alves Marques Carneiro <ee96090 fe up pt>
- To: gtk-devel-list gnome org
- Subject: Menu popup bug?
- Date: Wed, 21 Mar 2001 16:43:48 +0000 (WET)
In the example in attachment, a window with a button is
created. Clicking on the button pops up a menu.
When the pointer moves into the first item of the poped up menu, which
has a submenu, the submenu appears. When I move the pointer down, instead
of highlighting other menu items, the first one remains active.
This doesn't occur if the first menu item selected doesn't have a
submenu.
It looks like a bug, doesn't it? The question is, is it in GTK or in the
program?
--
Gustavo J.A.M. Carneiro
[linuxdeec.fe.up.pt/~ee96090]
#include <gtk/gtk.h>
void button_cb(GtkWidget *button)
{
int i;
GtkWidget *menu, *item1, *item2, *menu1;
menu = gtk_menu_new();
gtk_widget_show(menu);
for (i = 0; i < 5; i++)
{
item1 = gtk_menu_item_new_with_label("item");
gtk_widget_show(item1);
gtk_menu_append (GTK_MENU (menu), item1);
menu1 = gtk_menu_new();
gtk_widget_show(menu1);
item2 = gtk_menu_item_new_with_label("item2");
gtk_widget_show(item2);
gtk_menu_append (GTK_MENU (menu1), item2);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item1), menu1);
}
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
NULL, NULL);
}
void main (int argc, char *argv[])
{
GtkWidget *window, *button;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
button = gtk_button_new_with_label("menu button");
gtk_container_add (GTK_CONTAINER (window), button);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC(button_cb), NULL);
gtk_widget_show_all (window);
gtk_main();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]