I want to find...

Search

Shares

Table of Content

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()

Description

Set TextInput text.

Syntax

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

Parameters

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

Return

None.

Example

#include "myhmi.h"

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

void loop() {
  // ...
}

getTextInputText()

Description

Get TextInput text.

Syntax

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

Parameters

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

Return

TextInput text.

Example

#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 and END_HMI_EVENT_PROC.

Description

Determine TextInput is applied.

Syntax

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

Parameters

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

Return

Bool. Determine TextInput is applied.

Example

#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 and END_HMI_EVENT_PROC.

Description

Determine TextInput is canceled.

Syntax

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

Parameters

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

Return

Bool. Determine TextInput is canceled.

Example

#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 Editor User Manual for more instructions on 86HMI widgets and API usage.

Scroll to Top