如何禁用GTK3中的按钮
问题描述:
Windows API具有名为 EnableWindow
的功能,该功能会禁用控件,因此用户无法再与它们进行交互.
Windows API has a function called EnableWindow
that disables controls so user can't interact with them any more.
GTK3或GTK3 ++是否等效?
Is there an equivalent for GTK3 or GTK3++?
答
gtk_widget_set_sensitive (widget, FALSE);
请注意,如果您需要检查小部件是否敏感,则 gtk_widget_get_sensitive()
返回使用上述函数设置的值,并且 gtk_widget_is_sensitive()
会告诉您是否小部件确实很敏感-这也受父小部件敏感性的影响.
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.