Set_action_name + set_sensitive for Gtk::Button (gtkmm)

Trying to create new button disabled by default (on construct) but it’s still clickable, maybe that’s because of set_action_name.

Is any ideas how to make it disabled?

// class Forward : public Gtk::Button
Forward::Forward()
{
    set_action_name(
        "win.tab_history_forward"
    );

    set_sensitive(
        false // no effect
    );
}

Hi,

Yes, I think when using an action, then the button sensitivity follows the action status.

Is it a GioSimpleAction? if yes, try using Gio.SimpleAction.set_enabled

1 Like

Yes, forgot about this action method, should work.

Thank you

Interesting, can I toggle this action status by the name?

For example:

get_action_by_name("win.tab_history_forward")->set_enabled(false);

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.