Button is Checked 0/1 value

Hello all, (version 8.4) I’ve spent about an hour going through the documentation but can’t figure out this:

Is there a way to check the status of a button if it is checked? (not the actual event of it being checked)

Ideally I want to be able to multiply a value by a button status to only give the value during the time when the button is checked.

So kind of:

(lv_button_checked * value)

so that when the lv_button_checked is 1, the value of the calculation is “value”

cheers, Giles

Hello,

I’ve not tried this myself but I figure checking the state of the button might work.
See: Objects — LVGL documentation
And: Base object (lv_obj) — LVGL documentation

Something like this:

if (lv_obj_has_state(btn, LV_STATE_CHECKED) == true)
{
   /* something */
}

Yep that works perfectly - thank you @Tinus !! I’d not quite connected that Checked was a State and that I could use has_state in that way. Nice one.