Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I check if Gtk.CheckButton is checked?

Tags:

c#

gtk

gtk#

I am using GTK and I have inserted a CheckButton (GTK version of checkbox) to a window. Now I need to get if it's checked or not. How do I do that?

like image 681
Petr Avatar asked Mar 26 '13 16:03

Petr


2 Answers

Despite I fail to see advantage of QA site which answers with: google is your friend, I will answer this question for people who are (googling) looking for the same...

The property Active of Gtk.CheckButton is alternative of Checked in checkbox

so

if (checkbox.Active)
{
     // the checkbox was checked
} else
{
    // it wasn't checked
}
like image 132
Petr Avatar answered Nov 01 '22 06:11

Petr


First answer on google for the items gtk checkbox sharp (at least for me) yields http://www.mono-project.com/GtkSharp:_Buttons, goto the section Toggle buttons & Check buttons.

It's the Active member you need to check

like image 2
drahnr Avatar answered Nov 01 '22 08:11

drahnr