Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable buttons in GTK3

Tags:

c

gtk

gtk3

gtkmm

Windows API has a function called EnableWindow that disables controls so user can't interact with them any more.

Is there an equivalent for GTK3 or GTK3++?

like image 817
felknight Avatar asked Jan 21 '15 19:01

felknight


2 Answers

gtk_widget_set_sensitive (widget, FALSE);

Note that if you need to check whether a widget is sensitive, gtk_widget_get_sensitive() returns the value set with the above function and gtk_widget_is_sensitive() will tell you whether the widget really is sensitive -- this is affected by parent widgets sensitivity as well.

like image 188
Jussi Kukkonen Avatar answered Oct 02 '22 17:10

Jussi Kukkonen


For specific control, I think you can use "set_sensitive":

var button = new Gtk.Button.with_label("Hello");

button.set_sensitive(false); // true to enable the button
like image 27
Thien Do Avatar answered Oct 02 '22 17:10

Thien Do