我想找...

搜尋

分享

目錄

86HMI::List

[Menu widgets]

Object Functions

List object.

List-1

List Properties.

List-2

Identifier:

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

Geometry:

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

Item Settings:

  • Number of Items: Number of items, from 2 to 16, default is 5.
  • Item1~n Text: Each item name.
  • Item1~n PrefixSymbol: Each item prefix symbol.

Options:

  • Spacing: Item space.
  • 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

getListSelectedItem()

描述

Get List selected item number.

語法

int getListSelectedItem(lv_obj_t* id);
int getListSelectedItem(char *name);

參數

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

Return

List the selected item number.

範例

#include "myhmi.h"

void setup() {
  Serial.begin(115200);
  while (!Serial);
  
  Hmi.begin();
  Serial.println(Hmi.getListSelectedItem(p1li1));
}

void loop() {
  // ...
}

listItemSelected()

The following Event Functions are written between BEGIN_HMI_EVENT_PROC 以及 END_HMI_EVENT_PROC.

描述

Determine List’s Item is selected.

語法

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

參數

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

Return

Bool. Determine List’s Item is selected.

範例

#include "myhmi.h"

void setup() {
  Serial.begin(115200);
  while (!Serial);
  
  Hmi.begin();
  // ...
}

void loop() {
  // ...
  BEGIN_HMI_EVENT_PROC
  {
    if (Hmi.listItemSelected(p1li1))
    {
      Serial.println(Hmi.getListSelectedItem(p1li1));
    }
  }
  END_HMI_EVENT_PROC
}

Please see the 86HMI 編輯器使用手冊 for more instructions on 86HMI widgets and API usage.

返回頂端