I want to find...

Search

Shares

Table of Content

86HMI::ImageToggleButton

[Control widgets]

Object Functions

Image Toggle Button object. Each of the two states has a corresponding state and event.

ImageToggleButton-1

To use the ImageToggleButton object, you need to add the required image file to the image file resource and select the image file you want to use from the ImageToggleButton in the property grid.

Note:
Since the image files are not directly zoomed in or out on 86HMI. Users need to edit the image files beforehand to meet the required size for displaying on the HMI screen.

ImageToggleButton Properties.

ImageToggleButton-2

Identifier:

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

Content:

  • Image (Unchecked): Object image when is Unchecked, it can be set as the default image.
  • Image (Checked): Object image when is Checked, it can be set as the default image. For a description of the image source, see Image File Resource.
  • Checked: Default ImageToggleButton state.

Geometry:

  • X: Object X coordinate.
  • Y: Object Y coordinate.
  • Width: Object width. Cannot be adjusted by default.
  • Height: Object height. Cannot be adjusted by default.

Options:

  • PressedEffect: The effect of pressing the ImageToggleButton object.
    1. Darken
    2. Shrink
    3. Both
  • Opacity: ImageToggleButton object opacity ratio.
  • 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.

ImageToggleButton Events.

ImageToggleButton-3

ImageToggleButton object event conditions: Checked, Unchecked.

ImageToggleButton-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.

ImageToggleButton-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

setImageToggleButtonState()

Description

Set ImageToggleButton State.

Syntax

void setImageToggleButtonState(lv_obj_t* id, bool checked);
void setImageToggleButtonState(char* name, bool checked);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] checked
    Bool. ImageToggleButton state, Checked or Unchecked.

Return

None.

Example

#include "myhmi.h"

void setup() {
	Hmi.begin();
  // put your setup code here, to run once:
  Hmi.setImageToggleButtonState(p1itb1, true);
}

void loop() {
  // ..
}

getImageToggleButtonState()

Description

Get ImageToggleButton State.

Syntax

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

Parameters

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

Return

ImageToggleButton State.

Example

#include "myhmi.h"

void setup() {  
	Hmi.begin();
  // put your setup code here, to run once:
  if (Hmi.getImageToggleButtonState(p1itb1) == 0) {
    Hmi.setImageToggleButtonState(p1itb1, true);
  }
}

void loop() {
  // ..
}

imageToggleButtonChecked()

The following Event Functions are written between BEGIN_HMI_EVENT_PROC and END_HMI_EVENT_PROC.

Description

Determine ImageToggleButton is checked.

Syntax

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

Parameters

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

Return

Bool. Determine ImageToggleButton 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.imageToggleButtonChecked(p1itb1))
    {
       // do something.
    }
  }
  END_HMI_EVENT_PROC
}

imageToggleButtonUnchecked()

The following Event Functions are written between BEGIN_HMI_EVENT_PROC and END_HMI_EVENT_PROC.

Description

Determine ImageToggleButton is unchecked.

Syntax

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

Parameters

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

Return

Bool. Determine ImageToggleButton 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.imageToggleButtonUnchecked(p1itb1))
    {
       // do something.
    }
  }
  END_HMI_EVENT_PROC
}

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

Scroll to Top