Re: problem with custom menu
- From: John Taber <jtaber johntaber net>
- To: Murray Cumming <murrayc murrayc com>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: problem with custom menu
- Date: Fri, 22 Apr 2005 11:03:47 -0600
Huh? I'm simply trying to build a simple menu and "::attach" with the table
coordinates is exactly what is in the gtkmm API documentation (under
widgets/menu) and what compiles (menu->append will not compile for me). I
don't want to use actions for several reasons related to what other widgets I
want on a toolbar and besides, simple menus should be just as little coding
as using all the action statements and xml descriptions. I got the feeling
that the ::attach with table coordinates was new in 2.4 but I am not trying
to debate that - I simply cannot attach/append, whatever, sub items to my
file menu and there are no examples with attach so I would appreciate any
help trying to get this to work. Yes, it should not be difficult, I am not
trying to do anything strange here.
John
On Friday 22 April 2005 10:31, Murray Cumming wrote:
> On Fri, 2005-04-22 at 10:19 -0600, John Taber wrote:
> > You are right, the table coordinates are different - previously you could
> > just append the menuitem.
>
> What is this "previously" API?
>
> I didn't even know that this Menu::attach() method existed. What are you
> actually trying to do? I'm sure there's a less painful way.
>
> > 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]