I want to find...

Search

Shares

Table of Content

86HMI::Button

[Control widgets]

Object Functions

Button object.

button-1

Button Properties.

button-2

Identifier:

  • ID: Unique number that identifies the object.
  • Name: User-definable name for the object. It can be used with 86HMI API.

Content:

  • PrefixSymbol: Select the built-in button icon as an embellishment icon and scroll the mouse to drop down the options.
  • Text: Butten content text.

Geometry:

  • X: Object X coordinate.
  • Y: Object Y coordinate.
  • Width: Object width.
  • Height: Object height.

Options:

  • Type: Button style.
    1. Appearance A: Only the border of the object is colored.button-app-a
    2. Appearance B: Fill in the object color without the border.button-app-b
    3. Invisible: Object without any color.button-app-invisible
  • 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.

Button Events.

button-3

Button object event conditions: Clicked, Pressing.

button-4

The following instructions can be added: Page Change, Set Language, Play Sound, and Custom Instruction.
For instructions on how to use the commands for an event, see Events Instruction Functions.

button-5

Note:
Custom Instruction allows the user to edit the events to be executed by the object or page using the editing code. This option is a professional advanced option, and the user should be familiar with the 86Duino program before editing.


API Functions

buttonClicked()

The following Event Functions are written between BEGIN_HMI_EVENT_PROC and END_HMI_EVENT_PROC.

Description

Determine whether the Button is clicked or not.

Syntax

bool buttonClicked(lv_obj_t* id);
bool buttonClicked(char* name);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.

Return

Bool. Determine whether the Button is clicked or not.

Example

#include "myhmi.h"

void setup() {
	Hmi.begin();
}

void loop() {
  BEGIN_HMI_EVENT_PROC
  {
    if (Hmi.buttonClicked(p1b1))
    {
      // do something...
    }
  }
  END_HMI_EVENT_PROC
}

buttonPressing()

The following Event Functions are written between BEGIN_HMI_EVENT_PROC and END_HMI_EVENT_PROC.

Description

Determine whether the Button is pressing or not.

Syntax

bool buttonPressing(lv_obj_t* id);
bool buttonPressing(char* name);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.

Return

Bool. Determine whether the Button is pressing or not.

Example

#include "myhmi.h"

void setup() {
	Hmi.begin();
}

void loop() {
  BEGIN_HMI_EVENT_PROC
  {
    if (Hmi.buttonPressing(p1b1))
    {
      // do something...
    }
  }
  END_HMI_EVENT_PROC
}

Please see the 86HMI Editor User Manual for more instructions on 86HMI widgets and API usage.

Leave a Comment

Scroll to Top