Gtk::Menu No submenus.



Hi all,
I'm still a gtkmm newbie.

I'm subclassing Gtk::Window and creating a menubar in the
constructor "see the attached code please".

The menubar is created but it has no sub menus,
Did I hit a bug ? Or am I doing something wrong ?

Attached a code sample:
g++ -o m m.cc `pkg-config gtkmm-2.4 --cflags --libs`


-- 
GNU/Linux registered user #224950
Proud Egyptian GNU/Linux User Group <www.eglug.org> Member.
Life powered by Debian, Homepage: www.foolab.org
--
Don't send me any attachment in Micro$oft (.DOC, .PPT) format please
Read http://www.gnu.org/philosophy/no-word-attachments.html
Preferable attachments: .PDF, .HTML, .TXT
Thanx for adding this text to Your signature
#include <gtkmm.h>

class Win : public Gtk::Window {
 public:
  Win();
 private:
  Gtk::MenuBar mbar;
};

Win::Win()
{
  Gtk::Menu file_menu, edit_menu;
  mbar.items().push_back(Gtk::Menu_Helpers::MenuElem("_File", file_menu));
  file_menu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::Stock::OPEN));
  mbar.items().push_back(Gtk::Menu_Helpers::MenuElem("_Edit", edit_menu));
  add(mbar);
  show_all();
}

int main(int argc, char *argv[])
{
  Gtk::Main kit(&argc, &argv);
  Win win;
  win.show_all();
  kit.run(win);

  return 0;
}

Attachment: signature.asc
Description: Digital signature



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