复选框¶
复选框是带有“选中”指示器的按钮,该指示器显示在其标签旁边。
GtkWidget *check = gtk_check_button_new_with_label ("Show title");
// "on_toggled" is defined elsewhere
g_signal_connect (check, "toggled", G_CALLBACK (on_toggled), NULL);
check = Gtk.CheckButton(label="Show title")
# "on_toggled" is defined elsewhere
check.connect("toggled", on_toggled)
var check = new Gtk.CheckButton.with_label ("Show title");
// "on_toggled" is defined elsewhere
check.toggled.connect (on_toggled);
const check = new Gtk.CheckButton({ label: "Show title" });
// "on_toggled" is defined elsewhere
check.connect("toggled", on_toggled);
组件的常用方法¶
复选框可以设置为“不一致”状态:既不是活动状态也不是非活动状态。您可以使用
set_inconsistent()方法来设置此状态。如果您想为复选框启用助记符快捷键,可以使用
new_with_mnemonic()构造函数,或set_use_underline()方法。
API 参考¶
在示例中,我们使用了以下类