mirror of
https://github.com/s00500/ESPUI.git
synced 2024-12-23 00:40:49 +00:00
send button value for button text
This commit is contained in:
parent
3c26def22a
commit
6d206d21f9
@ -87,7 +87,7 @@ void ESPUIClass::label(const char *label, String value) {
|
||||
cIndex++;
|
||||
}
|
||||
|
||||
void ESPUIClass::button(const char *label, void (*callBack)(Control*, int)) {
|
||||
void ESPUIClass::button(const char *label, void (*callBack)(Control*, int), String value) {
|
||||
if (labelExists(label)) {
|
||||
if (debug) Serial.println("UI ERROR: Element " + String(label) + " exists, skipping creating element!");
|
||||
return;
|
||||
@ -96,6 +96,12 @@ void ESPUIClass::button(const char *label, void (*callBack)(Control*, int)) {
|
||||
Control *newB = new Control();
|
||||
newB->type = UI_BUTTON;
|
||||
newB->label = label;
|
||||
|
||||
if (value != "")
|
||||
newB->value = value; // Init with labeltext
|
||||
else
|
||||
newB->value = String(label);
|
||||
|
||||
newB->callback = callBack;
|
||||
newB->id = cIndex;
|
||||
controls[cIndex] = newB;
|
||||
|
@ -63,7 +63,7 @@ void begin(const char* _title); // Setup servers and page
|
||||
|
||||
// Creating Elements
|
||||
void label(const char* label, String value = ""); // Create Label
|
||||
void button(const char* label, void (* callBack)(Control*, int)); // Create Event Button
|
||||
void button(const char* label, void (* callBack)(Control*, int), String value = ""); // Create Event Button
|
||||
void switcher(const char* label, bool startState, void (* callBack)(Control*, int)); // Create Toggle Button
|
||||
void pad(const char* label, bool centerButton, void (* callBack)(Control*, int)); // Create Pad Control
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user