Re: how to connect Gio::SimpleAction signal



Hi Daniel,
Thanks for your reply.
Sorry that I wasn't clear. I've been trying to connect the signal using
the same method I've used before. I looked at set_action and target. Is
that the proper way to connect the MenuItem to my handler? Is target
the name/address of my handler? I wish I could have found an example.

The program doesn't compile. I get an error similar to:
error: no match for call to ‘(sigc::bound_mem_functor1<void,
geode::Gui, unsigned int&>) (const Glib::VariantBase&, unsigned int&)’

The actual error changes slightly depending on how I try to connect.

OK, I've been playing around with MenuItem::set_action and _target.
This is what I have so far:
ref_action = Gio::SimpleAction::create("FRONT");
        Glib::RefPtr<Gio::MenuItem> front_item =
Gio::MenuItem::create("FRONT", menumodel);
        front_item->set_action_and_target("ref_action",
Gui::on_cv_menu_clicked(index));
        giomenu->append("FRONT", "menumodel");

but this results in compiler error:
mber function ‘void geode::Gui::create_cv_menu()’:
xwin.cpp:36:80: error: invalid use of void expression
  front_item->set_action_and_target("ref_action",
Gui::on_cv_menu_clicked(index));
                  

I still don't understand what to do with the VariantBase target value
from:
void    set_action_and_target (const Glib::ustring& action, const
Glib::VariantBase& target_value)

There must be a way to tie the signal handler( on_cv_menu_clicked) to
the MenuItem and action, but I don't see it.
What is the target value supposed to be?

So much for my ramblings....
Thanks for any help you can provide.
Marty
On Thu, 2017-12-14 at 12:01 +0000, Daniel Boles wrote:
Anyway, if what you're trying to do is invoke an Action in your
MenuItem click handler, shouldn't you just be using
Gio::MenuItem.set_action() or .set_action_and_target(), and let GIO
handle all that, instead of reinventing the wheel? Maybe I
misunderstood, in which case, a clearer and step-by-step explanation
of what you want to do would be good.

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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