[gtkmm] Popup Menu problem
- From: "Find All" <find_all hotmail com>
- To: gtkmm-list gnome org
- Subject: [gtkmm] Popup Menu problem
- Date: Thu, 17 Jun 2004 11:46:10 +0000
I want to display a popup menu from my main window, I've based the code from
the docs:
http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch10.html
The menu is displayed well, but the callbacks (signal) associated to the
submenus are not executed.
.hh:
Gtk::Menu *menu_popup;
Gtk::Menu *sub_menu1;
.cc:
The popup menu calling code:
if(!(ev->state&GDK_BUTTON1_MASK)&&!(ev->state&GDK_BUTTON2_MASK)&&(ev->state&GDK_BUTTON3_MASK))
{
if(this->configurar_menu_popup()>=0)
this->menu_popup->popup(ev->button,ev->time);
return true;
}
The popupmenu configuration code:
gint window1::configurar_menu_popup()
{
if(!this->sub_menu1)
{
this->sub_menu1 = new Gtk::Menu();
}
if(!this->menu_popup)
{
this->menu_popup = new Gtk::Menu();
}
// Clear the submenu
this->sub_menu1->items().clear();
// Clear the main menu
this->menu_popup->items().clear();
Gtk::Menu::MenuList& menulist = this->menu_popup->items();
menulist.push_back(Gtk::Menu_Helpers::MenuElem("_Centrar Barco",
SigC::slot(*this,&window1::centrar_barco)));
menulist.push_back(Gtk::Menu_Helpers::MenuElem("_Lista Cartas",
SigC::slot(*this,&window1::on_carga_carta1_activate)));
Gtk::Menu::MenuList& menulist1 = this->sub_menu1->items();
menulist1.push_back(Gtk::Menu_Helpers::MenuElem("Maxima",
SigC::slot(*this,&window1::maxima_lat_lon)));
menulist1.push_back(Gtk::Menu_Helpers::MenuElem("Media",
SigC::slot(*this,&window1::media_lat_lon)));
menulist1.push_back(Gtk::Menu_Helpers::MenuElem("Minima",
SigC::slot(*this,&window1::minima_lat_lon)));
menulist1.push_back(Gtk::Menu_Helpers::MenuElem("Desactivar",
SigC::slot(*this,&window1::desactivar_lat_lon)));
menulist.push_back(Gtk::Menu_Helpers::MenuElem("_Regleta",*this->sub_menu1));
this->menu_popup->accelerate(*this);
show_all_children();
return true;
}
_________________________________________________________________
Descarga gratis la Barra de Herramientas de MSN
http://www.msn.es/usuario/busqueda/barra?XAPID=2031&DI=1055&SU=http%3A//www.hotmail.com&HL=LINKTAG1OPENINGTEXT_MSNBH
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]