I want to find...

Search

Shares

Table of Content

86HMI::Label

[Primitives widgets]

Object Functions

Label object. Used to display text.

label-1

Label Properties.

label-2

Identifier:

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

Content:

  • Text: Label content.
  • PrefixText: Prefix text in front of the label.
  • SuffixText: Suffix text after the label.

Geometry:

  • X: Object X coordinate.
  • Y: Object Y coordinate.
  • Width: Object width. It cannot be adjusted by default; you need to set TextAlign before you can set the width.
  • Height: Object height. It cannot be adjusted by default.

Options:

  • TextAlign: Text align. It can be left, right, and center.
  • 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.
  • Order: Object order. It can adjust the object order by up/down, which can be viewed on the Object List.

API Functions

setLabelText()

Description

Set Label text.

Syntax

setLabelText(lv_obj_t* id, const char* text);
setLabelText(char* name, const char* text);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] text
    Set Label text.

Return

None.

Example

#include "myhmi.h"

void setup() {
  Hmi.begin();
  // put your setup code here, to run once:
  Hmi.setLabelText(p1l1, "Hello");
}

void loop() {
  // ...
}

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

Leave a Comment

Scroll to Top