# Is there any way to get the current state of a checkbox in G4P?

**URL:** <https://discourse.processing.org/t/is-there-any-way-to-get-the-current-state-of-a-checkbox-in-g4p/19963>\
**Category:** Libraries\
**Created:** [April 20, 2020, 3:45pm UTC](https://discourse.processing.org/t/is-there-any-way-to-get-the-current-state-of-a-checkbox-in-g4p/19963 "2020-04-20T15:45:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/david/32/8853_2.png) [@David](https://discourse.processing.org/u/David)\
**Post date:** [April 20, 2020, 3:45pm UTC](https://discourse.processing.org/t/is-there-any-way-to-get-the-current-state-of-a-checkbox-in-g4p/19963/1 "2020-04-20T15:45:19Z")

</div>

Is there any way to get the current state of a checkbox in G4P? I can get the value of a slider or knob with the function ‘getValueF’, but I couldn’t find any corresponding function to get the value of a checkbox (ie, on or off, checked or unchecked). Am I missing something, or do I have to store the state somewhere outside of the checkbox object itself?

Thanks.

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [April 20, 2020, 3:51pm UTC](https://discourse.processing.org/t/is-there-any-way-to-get-the-current-state-of-a-checkbox-in-g4p/19963/2 "2020-04-20T15:51:30Z")

</div>

`cbx.isSelected();` returns true if the checkbox is selected else it returns false. Same for GOption controls.

They both inherit form the [GToggleControl](http://www.lagers.org.uk/g4p/ref/classg4p__controls_1_1_g_toggle_control.html) and this method is in that class.

---

<div class="post-metadata">

**Author:** ![David](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/david/32/8853_2.png) [@David](https://discourse.processing.org/u/David)\
**Post date:** [April 20, 2020, 4:01pm UTC](https://discourse.processing.org/t/is-there-any-way-to-get-the-current-state-of-a-checkbox-in-g4p/19963/3 "2020-04-20T16:01:36Z")

</div>

Thanks! I don’t know how I missed that.
