[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()
描述
Set Checkbox state.
語法
void setCheckboxState(lv_obj_t* id, bool checked);
void setCheckboxState(char* name, bool checked);
參數
[in] id
Object ID.[in] name
Object Name.[in] checked
Bool. Checkbox state, Checked or Unchecked.
Return
無
範例
#include "myhmi.h"
void setup() {
Hmi.begin();
// put your setup code here, to run once:
Hmi.setCheckboxState(p1cb1, true);
}
void loop() {
// ...
}getCheckboxState()
描述
Get Checkbox state.
語法
bool getCheckboxState(lv_obj_t* id);
bool getCheckboxState(char* name);
參數
[in] id
Object ID.[in] name
Object Name.
Return
Checkbox state.
範例
#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 以及 END_HMI_EVENT_PROC.
描述
Determine Checkbox is checked.
語法
bool checkboxChecked(lv_obj_t* id);
bool checkboxChecked(char* name);
參數
[in] id
Object ID.[in] name
Object Name.
Return
Bool. Determine Checkbox is checked.
範例
#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 以及 END_HMI_EVENT_PROC.
描述
Determine Checkbox is unchecked.
語法
bool checkboxUnchecked(lv_obj_t* id);
bool checkboxUnchecked(char* name);
參數
[in] id
Object ID.[in] name
Object Name.
Return
Bool. Determine Checkbox is unchecked.
範例
#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使用手冊 for more instructions on 86HMI widgets and API usage.