Gtk::Menu label not showing up after the first time displaying menu
- From: "Jim Barnes" <j r barnes larc nasa gov>
- To: <gtkmm-list gnome org>
- Subject: Gtk::Menu label not showing up after the first time displaying menu
- Date: Thu, 26 Oct 2006 13:54:37 -0400
Hi all,
I've having problems with Gtk::Menus and popup-menus not displaying their
labels. The first time that the menu is displayed, all menu labels are
displayed properly. On subsequent displays of the menu, the popup window for
the menu is displayed, but the window is missing the menu item labels. When
the mouse goes over the popup window, the labels show up one by one. Even
the separator lines are missing.
Here is a code snippet from my class. Any help would be appreciated.
Thanks
Jim
HangarDialog::HangarDialog()
: Gtk::Window(),
....
{
// Set the window parameters.
set_title("Hangar");
set_resizable(true);
const int border_width = 10;
set_border_width(border_width);
// Initialize the list of dialogs to add models to the simulation.
add_model_dialogs[MODEL] = 0;
add_model_dialogs[STATIC_MODEL] = 0;
add_model_dialogs[PLAYBACK_MODEL] = 0;
const int spacing = 5; // Spacing for formatting boxes.
// Create the vertical packing box into which all objects will be placed.
main_box = new Gtk::VBox(false, spacing);
assume(main_box);
main_box->show();
add(*main_box);
// Create the model_list that will be needed for the menu
model_list = new PositionalModelList;
// Create the Menu interface
// Create a reference action group
ref_action_group = Gtk::ActionGroup::create();
// Define the actions
ref_action_group->add(Gtk::Action::create("SimMenu", "_Simulation"));
ref_action_group->add(
Gtk::Action::create("SimControl",
"Sim Control",
"Modify simulation configuration."),
sigc::mem_fun(this, &HangarDialog::showSimControlDialog));
ref_action_group->add(
Gtk::Action::create("SimEnvironment",
"Environment",
"Modify the simulation environment."),
sigc::mem_fun(this, &HangarDialog::showEnvironmentDialog));
ref_action_group->add(
Gtk::Action::create("SimClose",
"Close Hanger", "Close this dialog."),
sigc::mem_fun(this, hide));
(bunch more menus.....)
ref_action_group->add(Gtk::Action::create("HelpMenu", Gtk::Stock::HELP,
"Help"));
// Create a ui_manager
ui_manager = Gtk::UIManager::create();
// Insert the the ActionGroup
ui_manager->insert_action_group(ref_action_group);
// Layout the actions in a menubar
try
{
Glib::ustring ui_info =
"<ui>"
" <menubar name='Menubar'>"
" <menu action='SimMenu'>"
" <menuitem action='SimControl'/>"
" <menuitem action='SimEnvironment'/>"
" <separator/>"
" <menuitem action='SimClose'/>"
" </menu>"
" <menu action='ModelsMenu'>"
" <menu action='ModelsAddMenu'>"
" <menuitem action='AddModel'/>"
" <menuitem action='AddPlayback'/>"
" <menuitem action='AddStatic'/>"
" </menu>"
" <menuitem action='ModelsDelete'/>"
" </menu>"
" <menu action='HardwareMenu'>"
" <menuitem action='HardwareDrivers'/>"
" <menuitem action='HardwareInterfaces'/>"
" <menuitem action='HardwareChangeSelected'/>"
" </menu>"
" <menu action='HelpMenu'>"
" </menu>"
" </menubar>"
"</ui>";
ui_manager->add_ui_from_string(ui_info);
}
catch ( const Glib::Error& ex)
{
string error = "Buiding Menu Bar faild: " + ex.what();
TerminalIO::applicationError("PlotMenuBarFactory::PlotMenuBarFactory()",
error.c_str(), false, true);
}
// Add the menubar to the vbox
Gtk::Widget* menu_bar = ui_manager->get_widget("/Menubar");
if (menu_bar)
{
main_box->pack_start(*menu_bar, Gtk::PACK_SHRINK);
}
...
show_all_children();
// Every 10 ms update the components of this dialog.
const int update_period_in_milliseconds = 10;
Glib::signal_timeout().
connect(sigc::mem_fun(this, &HangarDialog::updateComponents),
update_period_in_milliseconds);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]