Re: disabling a MenuItem easily when using Menu_Helpers?
- From: Murray Cumming <murrayc murrayc com>
- To: Philip Lowman <philip yhbt com>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: disabling a MenuItem easily when using Menu_Helpers?
- Date: Wed, 05 Jan 2005 21:49:56 +0100
You can either
a) Use Gtk::UIManager.
b) Use items().back() after you add an item, and store the widget for
later.
On Wed, 2005-01-05 at 15:08 -0500, Philip Lowman wrote:
> I've created some menus with the Gtk::Menu_Helpers interface as shown but
> now I would like to be able to call set_sensitive(false) on some of the
> entries to disable them. One way I found of doing this is simply creating
> a MenuList like so and referring to the index of the MenuItem I care about
> by number:
>
> void MainWindow::on_menu_help_about()
> {
> Gtk::Menu::MenuList& menulist = m_editmenu.items();
> menulist[0].set_sensitive(false);
> }
>
> Unfortunately this seems a rather restrictive way of doing things since it
> assumes that I know the menu layout beforehand. I know that in gtk if you
> use a call like gtk_item_factory_get_widget(item_factory,
> "path/to/menu/item") you can get a handle to the widget and disable the
> menu entry.
>
> Is there an equivalent way to do this in gtkmm when you construct the
> MenuList with the Menu_Helpers interface as shown above or would I have to
> build the Menu up manually? I suppose I could use a hash table, constants
> or something else for a more convenient way to use the [] indexing but
> even then it seems less than ideal.
>
> I know, I'm probably trying to have my cake and eat it too...
>
--
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]