我想找...

搜尋

分享

目錄

86HMI::TextList

[Visualization widgets]

Object Functions

TextList Object

TextList-1

TextList Properties.

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

Options:

  • LineNumbers: Determines whether to display line numbers.
  • LineBorder: Display styles of the Lines border, with the options as None/Horizontal/Vertical/Both.
  • LineSpacing: Set the spacing between each line of text, with the options as None/Smaller/Normal/Larger.
  • TextIndent: Set the indent width between line numbers and text content, with the options as None/Normal/Larger/Largest.
  • LineCount: The maximum number of lines of text that can be displayed, with the options as 99/999/9999.
  • LineNum Color: Set the color style of line numbers.
  • TextColor: Set the color style of text content.
  • LineNum Font: Set the font style of line numbers.
  • TextFont: Set the font style of text content.
  • Odd-Line Color: The background color of odd-numbered rows in TextList can be set to any color.
  • Even-Line Color: The background color of even-numbered rows in TextList can be set to any color.
  • Focus-Line Color: Make the TextList scroll directly to the specified line and highlight the line. Set the color displayed by the Focus Line to match any theme color. It requires ArduBlock or myHMI API.
  • 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

setTextListLine()

描述

Set the TextList line.

語法

void setTextListLine(lv_obj_t* id, int lineNumber, char* text);
void setTextListLine(char* name, int lineNumber, char* text);

參數

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] int lineNumber
    The TextList Line number.
  • [in] char* text
    The content.

Return

範例

#include "myhmi.h"

void setup() {
  Hmi.begin();
  // ...
  Hmi.setTextListLine(p1tl1, 1, "This is the first line.");
}

void loop() {
  // ...
}

getTextListLine()

描述

Get the TextList line.

語法

char* getTextListLine(lv_obj_t* id, int lineNumber);
char* getTextListLine(char* name, int lineNumber);
char* getTextListLine(lv_obj_t* id, int lineNumber, char* buf);
char* getTextListLine(char* name, int lineNumber, char* buf);

參數

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] int lineNumber
    The TextList Line number.
  • [out] char* buf
    The content buffer.

Return

None or the TextList line content.

範例

#include "myhmi.h"

void setup() {
  Serial.begin(115200);
  while (!Serial);
  
  Hmi.begin();
  // ...
  Serial.println(Hmi.getTextListLine(p1tl1, 1));
}

void loop() {
  // ...
}

importToTextList()

描述

Import the specific path file content into the TextList object.

語法

void importToTextList(lv_obj_t* id, char* path);
void importToTextList(char* name, char* path);
void importToTextList(lv_obj_t* id, char* path, int disk);
void importToTextList(char* name, char* path, int disk);

參數

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] char* path
    The import file path.
  • [in] int disk
    The disk that the file comes from.

Return

範例

#include "myhmi.h"

void setup() {
  Hmi.begin();
  // ...
  Hmi.setFileBrowserDisk(p1fb1, USBDISK);
}

void loop() {
  // HMI event
  BEGIN_HMI_EVENT_PROC
  {
    // USB
    if (Hmi.buttonClicked(p1b1))
    {
      Hmi.importToTextList(p1tl1, Hmi.getFileBrowserFilePath(p1fb1), USBDISK);
    }
    if (Hmi.buttonClicked(p1b2))
    {
      Hmi.clearTextList(p1tl1);
    }
  }
  END_HMI_EVENT_PROC
  delay(100);
}

clearTextList()

描述

Clear all content of the TextList object.

語法

void clearTextList(lv_obj_t* id);
void clearTextList(char* name);

參數

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

Return

範例

#include "myhmi.h"

void setup() {
  Hmi.begin();
  // ...
  Hmi.setFileBrowserDisk(p1fb1, USBDISK);
}

void loop() {
  // HMI event
  BEGIN_HMI_EVENT_PROC
  {
    // USB
    if (Hmi.buttonClicked(p1b1))
    {
      Hmi.importToTextList(p1tl1, Hmi.getFileBrowserFilePath(p1fb1), USBDISK);
    }
    if (Hmi.buttonClicked(p1b2))
    {
      Hmi.clearTextList(p1tl1);
    }
  }
  END_HMI_EVENT_PROC
  delay(100);
}

focusTextListLine()

描述

Focus the TextList object line.

語法

void focusTextListLine(lv_obj_t* id, int lineNumber);
void focusTextListLine(char* name, int lineNumber);

參數

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] int lineNumber
    The TextList line number.

Return

範例

#include "myhmi.h"

void setup() {
  Hmi.begin();
  // ...
  Hmi.focusTextListLine(p1fb1, 1);
}

void loop() {
  // ...
}

setTextListViewRange()

描述

Set the view range of the TextList object line.

語法

void setTextListViewRange(lv_obj_t* id, int startLine, int endLine);
void setTextListViewRange(char* name, int startLine, int endLine);

參數

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] int startLine
    The TextList start line.
  • [in] int endLine
    The TextList end line.

Return

範例

#include "myhmi.h"

void setup() {
  Hmi.begin();
  // ...
  Hmi.setTextListViewRange(p1tl1, 1, 20);
}

void loop() {
  // ...
}

getTextListViewRangeStart()

描述

Get the view start range of the TextList object.

語法

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

參數

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

Return

The view start range of the TextList object.

範例

#include "myhmi.h"

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

void loop() {
  // ...
}

getTextListViewRangeEnd()

描述

Get the view end range of the TextList object.

語法

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

參數

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

Return

The view end range of the TextList object.

範例

#include "myhmi.h"

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

void loop() {
  // ...
}

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

返回頂端