Re: problem with custom menu



You are right, the table coordinates are different - previously you could just 
append the menuitem.  This is what I have now tried:
fileMenu = new Gtk::Menu();
newMenuItem = new Gtk::MenuItem("New");
fileMenu->attach(*newMenuItem,0,1,0,1);
openMenuItem = new Gtk::MenuItem("Open");
fileMenu->attach(*openMenuItem,0,1,0,2);
fileMenuItem = new Gtk::MenuItem("File", fileMenu);
menubar = new Gtk::MenuBar();
menubar->append(*fileMenuItem);
......
show_all_children();

"File" shows on the menubar but when clicked, the "New" or "Open" menuitems do 
not show.  Since I don't understand the table idea, I guess this is where the 
problem is (do the coordinates mean to the left or right of the calling menu, 
to the top or bottom ? ).  Btw - what is the best way to check versions on my 
installed gtk, gtkmm, glib.... (one machine is Fedora, one is ubuntu debian).  
thks.


On Friday 22 April 2005 09:36, Murray Cumming wrote:
> On Fri, 2005-04-22 at 09:38 -0600, John Taber wrote:
> > Thanks for suggestion - it eliminated the error but my menuitems are
> > still not showing
>
> Are you calling show()?
>
> >  (to test I added a second one at 0,1,0,2).  I have read the
> > documentation but I cannot understand what the table is supposed to do
> > and maybe that is where my problem is.  btw other gtk documentation I
> > have showed a far simpler way - was this a change in gtk? or in gtkmm?
> > and is the old api eliminated just not deprecated?  thanks
>
> You'll have to show us what you mean.
>
> > John
> >
> > On Friday 22 April 2005 06:24, Murray Cumming wrote:
> > > On Fri, 2005-04-22 at 05:41 -0600, John Taber wrote:
> > > > I'm having a problem with the newer way to use a custom menu - can
> > > > someone help out - thanks.
> > > >
> > > > fileMenu = new Gtk::Menu();
> > > > openMenuItem = new Gtk::MenuItem("Open");
> > > > fileMenu->attach(*openMenuItem,0,0,0,0);
> > >
> > > Table (and Menu, I guess) attach coordinates are a bit odd. Like the
> > > warning says, you probably want 0, 1, 0, 1. This is hinted at in the
> > > documentation:
> > > http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1Men
> > >u.ht ml#a0
> > >
> > > I guess this should have default values. A patch would be welcome.
> > >
> > > But I personally prefer to use the UIManager anyway.
> > >
> > > > fileMenuItem = new Gtk::MenuItem("File", fileMenu);
> > > > menubar = new Gtk::MenuBar();
> > > > menubar->append(*fileMenuItem);
> > > > mainBox.pack_start(*menubar, Gtk::PACK_SHRINK);
> > > >
> > > > : Gtk-CRITICAL **: file gtkmenu.c: line 3836 (gtk_menu_attach):
> > > > : assertion
> > > >
> > > > `left_attach < right_attach' failed
> > > > _______________________________________________
> > > > gtkmm-list mailing list
> > > > gtkmm-list gnome org
> > > > http://mail.gnome.org/mailman/listinfo/gtkmm-list



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