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