I posted about this over on the GtkD site, but I suspect no one's
home until later in the day.
I've been writing up examples for menus and found some odd
behaviour. Now I'm wondering if I've missed something.
The code compiles without error and runs.
But after the window opens, first click on the menu results in a
blue line appearing under the menu title. Second click and the
menu finally drops.
This is the code boiled down to the bare minimum. It a single
menu with a single item which is a submenu and it, in turn, has a
single item.
The original was more elaborate with multiple menus and multiple
items, only one of which was a submenu. I've tried a number of
variations, but it seems that submenus always cause this
behaviour.
I've also tried various OOP versions of this code. Same result.
Any ideas about why this is happening? Bug? Bad code? Programmer
not holding mouth in correct position?
import std.stdio;
import gtk.MainWindow;
import gtk.Box;
import gtk.Main;
import gtk.Menu;
import gtk.MenuBar;
import gtk.MenuItem;
import gtk.Widget;
import gdk.Event;
void main(string[] args)
{
Main.init(args);
MainWindow testRig = new MainWindow("Title");
Box appBox = new Box(Orientation.VERTICAL, 5);
testRig.add(appBox);
MenuBar menuBar = new MenuBar();
appBox.packStart(menuBar, false, false, 0);
MenuItem header = new MenuItem("File");
menuBar.append(header);
Menu fileMenu = new Menu();
header.setSubmenu(fileMenu);
MenuItem newFileItem = new MenuItem("New");
fileMenu.append(newFileItem);
Menu newFileSubmenu = new Menu();
newFileItem.setSubmenu(newFileSubmenu);
MenuItem dNewFileItem = new MenuItem("D File");
newFileSubmenu.append(dNewFileItem);
testRig.showAll();
Main.run();
} // main()
And it still does the same thing. First click, blue line. Second
click, menu drops.