我想找...

搜尋

分享

目錄

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

描述

Set NumberInput Value.

語法

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

參數

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

Return

範例

#include "myhmi.h"

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

void loop() {
  // ...
}

getNumberInputValue()

描述

Get NumberInput Value.

語法

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

參數

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

Return

NumberInput value.

範例

#include "myhmi.h"

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

void loop() {
  // ...
}

getNumberInputInteger()

描述

Get NumberInput integer value.

語法

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

參數

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

Return

NumberInput integer value.

範例

#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 以及 END_HMI_EVENT_PROC.

描述

Determine NumberInput is applied.

語法

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

參數

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

Return

Bool. Determine NumberInput is applied.

範例

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

描述

Determine NumberInput is canceled.

語法

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

參數

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

Return

Bool. Determine NumberInput is canceled.

範例

#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 編輯器使用手冊 for more instructions on 86HMI widgets and API usage.

返回頂端