Re: Gray out a menu item Edit/copy etc



On 04/07/17 03:25, Stefan Salewski wrote:
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
language.

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 from widget.

// 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.



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