Hi, I have some GtkMenuItem in my .glade file and I removed the
tick in Sensitive flag. The item is grayed out, good. Now I need
to turn it on/off so that I can use/disable it. Looking at the
Gtk3 manual I am not able to find any reference to sensitive.
A search on the internet gave
To re-enable the menu item:
but I am not able to determine what this is about or if it is
up-to-date or how to apply it. Any ideas there?
Also GtkImageMenuItem is still in glade-3-18-3 but Gtk tell me
that it has been depreciated since 3.10. I got it from the
Edit/Hierarchy. But it looks okay. Should I change it to
GtkMenuItem? Regards Ian.
> On Thu, 2017-04-06 at 19:52 -0400, Ian Chapman wrote:
>> Now I need to turn it on/off so that I can use/disable it.
> For GTK3 we have
> https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-set-sensitive >
> So there should be a similar function available for your programming
> Of course you need a reference to your menu item to pass to that
> function. Is that your real problem, the missing reference because your
> use of glade?
Thanks Stefan, I've got it now. I should be looking at widgets and I
guess all the widget stuff applies to all and sundry that is derived
// Variable declarations
GtkWidget *name; //name refs File/Open or Edit/copy etc
// In builder stuff added
name = GTK_WIDGET (gtk_builder_get_object (builder, "Open")); // if
called Open in Glade.
// In program (the part that's actually executed).
gtk_widget_set_sensitive(name, FALSE); // or TRUE as needed
Thanks a million, it's working great. Regards Ian.