[Control widgets]
Object Functions
Checkbox object.

Checkbox Properties.

Identifier:
- ID: Unique number that identifies the object.
- Name: User-definable name for the object. It can be used with 86HMI API.
Content:
- Text: Checkbox content.
- Checked: Default checkbox state.
Geometry:
- X: Object X coordinate.
- Y: Object Y coordinate.
- Width: Object width. It cannot be adjusted by default.
- Height: Object height. It cannot be adjusted by default.
Options:
- TextColor: Text color can be chosen through the color palette or by directly inputting the color code.
- TextFont: Choose from 6 default font styles. For font configuration instructions, please refer to Theme Management.
- ObjColor: Choose from 4 themed colors. For font configuration instructions, please refer to Theme Management.
- Enable: Select the default state of the object, enable or disable.
- Order: Object order. It can adjust the object order by up/down, which can be viewed on the Object List.
API Functions
setCheckboxState()
Description
Set Checkbox state.
Syntax
void setCheckboxState(lv_obj_t* id, bool checked);
void setCheckboxState(char* name, bool checked);
Parameters
[in] id
Object ID.[in] name
Object Name.[in] checked
Bool. Checkbox state, Checked or Unchecked.
Return
None.
Example
#include "myhmi.h" void setup() { Hmi.begin(); // put your setup code here, to run once: Hmi.setCheckboxState(p1cb1, true); } void loop() { // ... }
getCheckboxState()
Description
Get Checkbox state.
Syntax
bool getCheckboxState(lv_obj_t* id);
bool getCheckboxState(char* name);
Parameters
[in] id
Object ID.[in] name
Object Name.
Return
Checkbox state.
Example
#include "myhmi.h" void setup() { Hmi.begin(); // put your setup code here, to run once: } void loop() { if (Hmi.getCheckboxState(p1cb1)) { // do something. } }
checkboxChecked()
The following Event Functions are written between BEGIN_HMI_EVENT_PROC
and END_HMI_EVENT_PROC
.
Description
Determine Checkbox is checked.
Syntax
bool checkboxChecked(lv_obj_t* id);
bool checkboxChecked(char* name);
Parameters
[in] id
Object ID.[in] name
Object Name.
Return
Bool. Determine Checkbox is checked.
Example
#include "myhmi.h" void setup() { Hmi.begin(); // put your setup code here, to run once: } void loop() { BEGIN_HMI_EVENT_PROC { if (Hmi.checkboxChecked(p1cb1)) { // do something. } if (Hmi.checkboxUnchecked(p1cb1)) { // do something. } } END_HMI_EVENT_PROC }
checkboxUnchecked()
The following Event Functions are written between BEGIN_HMI_EVENT_PROC
and END_HMI_EVENT_PROC
.
Description
Determine Checkbox is unchecked.
Syntax
bool checkboxUnchecked(lv_obj_t* id);
bool checkboxUnchecked(char* name);
Parameters
[in] id
Object ID.[in] name
Object Name.
Return
Bool. Determine Checkbox is unchecked.
Example
#include "myhmi.h" void setup() { Hmi.begin(); // put your setup code here, to run once: } void loop() { BEGIN_HMI_EVENT_PROC { if (Hmi.checkboxChecked(p1cb1)) { // do something. } if (Hmi.checkboxUnchecked(p1cb1)) { // do something. } } END_HMI_EVENT_PROC }
Please see the 86HMI Editor User Manual for more instructions on 86HMI widgets and API usage.