s00500 / ESPUI

A simple web user interface library for ESP32 and ESP8266

Home Page:https://valencia.lbsfilm.at/midterm-presentation/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to input TIME ?

Atorcha opened this issue · comments

I would like to input TIME for activate a TIMER, but I dont know how treat the variable.
in void setup:

text_time = ESPUI.text("Time", time1_Callback, ControlColor::Dark, "13:00");
ESPUI.setInputType(text_time, "time");

in main

void time1_Callback(Control *sender, int text_time) {
Serial.print(" ");
Serial.println(sender->id);
Serial.print(text_time);

//This callback is needed to handle the changed values, even though it doesn't do anything itself.
}

Your callback is wonky. The definition of the callback is that it has two arguments:

  • A pointer to an instance of the Control class
  • An integer corresponding to the event type that has been triggered. Different controls might trigger different events, for example a button can trigger B_DOWN and B_UP events.

So you need to read the member variables in the Control instance to get what you want. Or in other words:

Serial.print(sender->value);