Re: Getting submenu from a MenuItem



Hi Toby,

To add an arbitrary widget to a Gtk::Menu you can create a MenuItem
and use ->add(). This is how I insert space into a menu. For example:

    # menu created, items added....

    # Spacer
    $menuItem = Gtk::MenuItem->new();
    $menuItem->show();
    $menu->append($menuItem);
    my $sbox = Gtk::HBox->new(0, 0);
    $sbox->show;
    $menuItem->add($sbox);
    my $slabel = Gtk::Label->new;
    $slabel->show;
    $sbox->pack_start($slabel, 1, 1, 0); # label expands to fill the box...

Perhaps this is what you are looking for??
Gavin


Toby Gray <toby gray ntlworld com> writes:

On Monday 28 January 2002 11:50 pm, you wrote:

get_submenu() is a function of the 2.0 API (which is not, afaik,
implemented in Perl yet).

Ahhhh ok thanks.

Without seeing your code, or exactly what you need to do, I can only
suggest that it might be easier to keep track of this yourself.
If you create a menu structure in a hash, it should be fairly trivial to
keep track of the heirarchy.  Though somebody else may have a much
better solution ;)

Well that was what I was hoping to do, but I want to also include seperators 
in a Gtk::Menu, which as far as I could see, can only be done using 
Gtk::itemfactory, which I think I might be wrong on, which I'm sure someone 
will point out to me. But when using Gtk::itemfactory I also can't find a 
method of getting the references to Gtk::MenuItems, so I'm sorta stuck really.

Toby
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list



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