我想找...

搜尋

分享

目錄

86HMI::DateInput

[Input widgets]

Object Functions

DateInput object.

DateInput-1

DateInput Properties. (After successfully uploading a DateInput object to the QEC master, clicking it will bring up the almanac)

DateInput-2
DateInput-3

Identifier:

  • ID: Unique number that identifies the object.
  • Name: User-definable name for the object. It can be used with 86HMI API.

Content:

  • Date: Default Date.

Geometry:

  • X: Object X coordinate.
  • Y: Object Y coordinate.
  • Width: Object width.
  • Height: Object height.

Options:

  • DateDisplay: Date display type. There are 6 formats to choose from.
  • 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

setDateInput()

描述

Set DateInput year/month/day.

語法

void setDateInput(lv_obj_t* id, int year, int month, int day);
void setDateInput(char* name, int year, int month, int day);

參數

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] year
    DateInput year.
  • [in] month
    DateInput month.
  • [in] day
    DateInput day.

Return

範例

#include "myhmi.h"

void setup() {
  Serial.begin(115200);
  while (!Serial);
  
  Hmi.begin();
  // ...
  Hmi.setDateInput(p1din1, 2024, 10, 1);
}

void loop() {
  // ...
  Serial.print("Year: ");
  Serial.print(Hmi.getDateInputYear(p1din1));
  Serial.print(", Month: ");
  Serial.print(Hmi.getDateInputMonth(p1din1));
  Serial.print(", Date: ");
  Serial.println(Hmi.getDateInputDay(p1din1));
  delay(100);
}

getDateInputYear()

描述

Get DateInput year.

語法

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

參數

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

Return

DateInput year.

範例

#include "myhmi.h"

void setup() {
  Serial.begin(115200);
  while (!Serial);
  
  Hmi.begin();
  // ...
  Hmi.setDateInput(p1din1, 2024, 10, 1);
}

void loop() {
  Serial.print("Year: ");
  Serial.print(Hmi.getDateInputYear(p1din1));
  Serial.print(", Month: ");
  Serial.print(Hmi.getDateInputMonth(p1din1));
  Serial.print(", Date: ");
  Serial.println(Hmi.getDateInputDay(p1din1));
  delay(100);
}

getDateInputMonth()

描述

Get DateInput month.

語法

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

參數

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

Return

DateInput month.

範例

#include "myhmi.h"

void setup() {
  Serial.begin(115200);
  while (!Serial);
  
  Hmi.begin();
  // ...
  Hmi.setDateInput(p1din1, 2024, 10, 1);
}

void loop() {
  Serial.print("Year: ");
  Serial.print(Hmi.getDateInputYear(p1din1));
  Serial.print(", Month: ");
  Serial.print(Hmi.getDateInputMonth(p1din1));
  Serial.print(", Date: ");
  Serial.println(Hmi.getDateInputDay(p1din1));
  delay(100);
}

getDateInputDay()

描述

Get DateInput Day.

語法

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

參數

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

Return

DateInput day.

範例

#include "myhmi.h"

void setup() {
  Serial.begin(115200);
  while (!Serial);
  
  Hmi.begin();
  // ...
  Hmi.setDateInput(p1din1, 2024, 10, 1);
}

void loop() {
  Serial.print("Year: ");
  Serial.print(Hmi.getDateInputYear(p1din1));
  Serial.print(", Month: ");
  Serial.print(Hmi.getDateInputMonth(p1din1));
  Serial.print(", Date: ");
  Serial.println(Hmi.getDateInputDay(p1din1));
  delay(100);
}

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

返回頂端