On Tue, 6 Oct 2020 09:04:07 +0200 Kjell Ahlstedt <kjellahlst...@gmail.com> wrote:
> Shall be > > auto simple_action = Glib::RefPtr<Gio::SimpleAction> > ::cast_dynamic(m_refActionGroup->lookup_action("PlacepieceBlackPawn")); > > > if (simple_action) > > simple_action->set_enabled(row != 0 && row != 7); Thanks that works. I have another problem with the same popup menu: I need certain menu entries to be radio actions (that is, only one can be selected at a time, but there are multiple such groups in the single popup menu). For example, I have: Gtk::RadioAction::Group group_to_move; m_refToMoveWhite_action = Gtk::RadioAction::create(group_to_move, "ToMoveWhite", "White to play"); m_refToMoveBlack_action = Gtk::RadioAction::create(group_to_move, "ToMoveBlack", "Black to play"); where the menu is read from a .glade file with Gtk::Builder, containing: <child> <object class="GtkRadioMenuItem" id="ToMoveWhite"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="action_name">PlacepieceMenu.ToMoveWhite</property> <property name="label" translatable="yes">White to play</property> <property name="use_underline">True</property> <property name="draw_as_radio">True</property> </object> </child> <child> <object class="GtkRadioMenuItem" id="ToMoveBlack"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="action_name">PlacepieceMenu.ToMoveBlack</property> <property name="label" translatable="yes">Black to play</property> <property name="use_underline">True</property> <property name="draw_as_radio">True</property> </object> </child> Now I want a function to be called when I click these entries. In the 2.4 code I had something like: m_refActionGroup->add_action(m_refToMoveWhite_action, sigc::mem_fun(*this, &ChessPositionWidget::on_menu_to_move_white)); m_refActionGroup->add_action(m_refToMoveBlack_action, sigc::mem_fun(*this, &ChessPositionWidget::on_menu_to_move_black)); But that doesn't compile anymore. Because so many things got deprecated, the types of many variables had to change and now I can't combine them anymore :/. Ie, m_refActionGroup now has the type: Glib::RefPtr<Gio::SimpleActionGroup> m_refActionGroup; maybe that has to be Glib::RefPtr<Gio::ActionGroup> before I can add both Gio::SimpleAction's and Gtk::RadioAction to it? The latter isn't derived from Gio:Action either though :/. I am totally stuck on this. Also cannot find any example that shows how to do this. I am just very confused about how all this is supposed to work. Before it seemed like that if I wanted to make a big pop-up menu then EVERY entry in the menu had to be an action and well all of the same group (that was using Gtk::UIManager). Now I'm using Gio::Action and Gtk::Builder instead and I have no idea how to make it working again. Carlo Wood _______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list