我想找...

搜尋

分享

目錄

86HMI::TextInput

[Input widgets]

Object Functions

TextInput object.

textInput-1

TextInput Properties.

textInput-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:

  • Keyboard: Set whether the virtual keyboard is displayed or not. The virtual keyboard appears when the user clicks the text input box to enter text.
  • 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

setTextInputText()

描述

Set TextInput text.

語法

void setTextInputText(lv_obj_t* id, char* text);
void setTextInputText(char* name, char* text);

參數

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

Return

範例

#include "myhmi.h"

void setup() {
  Hmi.begin();
  // ...
  Hmi.setTextInputText(p1tin1, "Text Input 1");
}

void loop() {
  // ...
}

getTextInputText()

描述

Get TextInput text.

語法

char* getTextInputText(lv_obj_t* id);
char* getTextInputText(char* name);

參數

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

Return

TextInput text.

範例

#include "myhmi.h"

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

void loop() {
  // ...
  Serial.println(Hmi.getTextInputText(p1tin1));
}

textInputApplied()

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

描述

Determine TextInput is applied.

語法

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

參數

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

Return

Bool. Determine TextInput is applied.

範例

#include "myhmi.h"

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

void loop() {
  // ...
  BEGIN_HMI_EVENT_PROC
  {
    if (Hmi.textInputApplied(p1tin1))
    {
      Serial.println(Hmi.getTextInputText(p1tin1));
    }
  }
  END_HMI_EVENT_PROC
}

textInputCanceled()

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

描述

Determine TextInput is canceled.

語法

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

參數

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

Return

Bool. Determine TextInput is canceled.

範例

#include "myhmi.h"

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

void loop() {
  // ...
  BEGIN_HMI_EVENT_PROC
  {
    if (Hmi.textInputCanceled(p1tin1))
    {
      Serial.println(Hmi.getTextInputText(p1tin1));
    }
  }
  END_HMI_EVENT_PROC
}

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

返回頂端