Re: Set menu items sensitive



2010/6/9 Glus Xof <gtglus gmail com>:
> Hi,
>
> I'm now working on a menu (UIManager technique) which should show some
> items only under certain conditions. For this, I did,
>
> Glib::RefPtr <Gtk::Action> myFirstItem;
>
> myFirstItem = Gtk::Action::create (....);   // All fine, 'till here.
>
> if (condition)
>    myFirstItem->set_sensitive (true);
> else
>    myFirstItem->set_sensitive (false);
>
> The problem is that the method set_sensitive() seems not to run when
> the structure *if* is readed further.
> Could change anymore else ?

What I done is,

    m_refUIManager->remove_action_group(r_ActionGroupMenu);

    // Make changes, and

    m_refUIManager->insert_action_group(r_ActionGroupMenu);


Regards,

Glus


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