On Tue, 6 Oct 2020 09:04:07 +0200
Kjell Ahlstedt wrote:
> Shall be
>
> auto simple_action = Glib::RefPtr
> ::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:
True
False
PlacepieceMenu.ToMoveWhite
White to play
True
True
True
False
PlacepieceMenu.ToMoveBlack
Black to play
True
True
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,
::on_menu_to_move_white));
m_refActionGroup->add_action(m_refToMoveBlack_action, sigc::mem_fun(*this,
::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 m_refActionGroup;
maybe that has to be Glib::RefPtr 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