I want to find...

Search

Shares

Table of Content

86HMI::NumberInput

[Input widgets]

Object Functions

NumberInput object.

NumberInput-1

NumberInput Properties.

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

  • Value Type: NumberInput value type, integer or decimal point.
  • Keyboard: Set whether the virtual keyboard is displayed. The virtual keyboard appears when the user clicks the NumberInput box to enter a number.
  • 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

setNumberInputValue()

Description

Set NumberInput Value.

Syntax

void setNumberInputValue(lv_obj_t* id, double value);
void setNumberInputValue(char* name, double value);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] value
    Default NumberInput Value.

Return

None.

Example

#include "myhmi.h"

void setup() {  
  Hmi.begin();
  // ...
  Hmi.setNumberInputValue(p1nin1, 100);
}

void loop() {
  // ...
}

getNumberInputValue()

Description

Get NumberInput Value.

Syntax

double getNumberInputValue(lv_obj_t* id);
double getNumberInputValue(char* name);

Parameters

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

Return

NumberInput value.

Example

#include "myhmi.h"

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

void loop() {
  // ...
}

getNumberInputInteger()

Description

Get NumberInput integer value.

Syntax

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

Parameters

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

Return

NumberInput integer value.

Example

#include "myhmi.h"

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

void loop() {
  // ...
}

numberInputApplied()

The following Event Functions are written between BEGIN_HMI_EVENT_PROC and END_HMI_EVENT_PROC.

Description

Determine NumberInput is applied.

Syntax

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

Parameters

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

Return

Bool. Determine NumberInput is applied.

Example

#include "myhmi.h"

void setup() {  
  Hmi.begin();
  // ...
}

void loop() {
  BEGIN_HMI_EVENT_PROC
  {
    if (Hmi.numberInputApplied(p1nin1))
    {
      Serial.println(Hmi.getNumberInputInteger(p1nin1));
    }
  }
  END_HMI_EVENT_PROC
}

numberInputCanceled()

Description

Determine NumberInput is canceled.

Syntax

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

Parameters

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

Return

Bool. Determine NumberInput is canceled.

Example

#include "myhmi.h"

void setup() {  
  Hmi.begin();
  // ...
}

void loop() {
  BEGIN_HMI_EVENT_PROC
  {
    if (Hmi.numberInputCanceled(p1nin1))
    {
      Serial.println(Hmi.getNumberInputInteger(p1nin1));
    }
  }
  END_HMI_EVENT_PROC
}

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

Scroll to Top