mirror of
https://github.com/s00500/ESPUI.git
synced 2024-11-25 03:50:54 +00:00
Support update of Button text
This commit is contained in:
parent
bc6e2bb8af
commit
55b291eb50
1
data/js/controls.js
vendored
1
data/js/controls.js
vendored
@ -537,6 +537,7 @@ function start() {
|
|||||||
|
|
||||||
case UPDATE_BUTTON:
|
case UPDATE_BUTTON:
|
||||||
$("#btn" + data.id).val(data.value);
|
$("#btn" + data.id).val(data.value);
|
||||||
|
$("#btn" + data.id).text(data.value);
|
||||||
if(data.hasOwnProperty('elementStyle')) {
|
if(data.hasOwnProperty('elementStyle')) {
|
||||||
$("#btn" + data.id).attr("style", data.elementStyle);
|
$("#btn" + data.id).attr("style", data.elementStyle);
|
||||||
}
|
}
|
||||||
|
2
data/js/controls.min.js
vendored
2
data/js/controls.min.js
vendored
@ -37,7 +37,7 @@ slider_move($("#id"+data.id),data.value,"100",false);if(data.hasOwnProperty('ele
|
|||||||
break;case UPDATE_NUMBER:$("#num"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#num"+data.id).attr("style",data.elementStyle);}
|
break;case UPDATE_NUMBER:$("#num"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#num"+data.id).attr("style",data.elementStyle);}
|
||||||
break;case UPDATE_TEXT_INPUT:$("#text"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#text"+data.id).attr("style",data.elementStyle);}
|
break;case UPDATE_TEXT_INPUT:$("#text"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#text"+data.id).attr("style",data.elementStyle);}
|
||||||
break;case UPDATE_SELECT:$("#select"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#select"+data.id).attr("style",data.elementStyle);}
|
break;case UPDATE_SELECT:$("#select"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#select"+data.id).attr("style",data.elementStyle);}
|
||||||
break;case UPDATE_BUTTON:$("#btn"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#btn"+data.id).attr("style",data.elementStyle);}
|
break;case UPDATE_BUTTON:$("#btn"+data.id).val(data.value);$("#btn"+data.id).text(data.value);if(data.hasOwnProperty('elementStyle')){$("#btn"+data.id).attr("style",data.elementStyle);}
|
||||||
break;case UPDATE_PAD:case UPDATE_CPAD:break;case UPDATE_GAUGE:$("#gauge"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#gauge"+data.id).attr("style",data.elementStyle);}
|
break;case UPDATE_PAD:case UPDATE_CPAD:break;case UPDATE_GAUGE:$("#gauge"+data.id).val(data.value);if(data.hasOwnProperty('elementStyle')){$("#gauge"+data.id).attr("style",data.elementStyle);}
|
||||||
break;case UPDATE_ACCEL:break;default:console.error("Unknown type or event");break;}
|
break;case UPDATE_ACCEL:break;default:console.error("Unknown type or event");break;}
|
||||||
if(data.type>=UPDATE_OFFSET&&data.type<UI_INITIAL_GUI){var element=$("#id"+data.id);if(data.hasOwnProperty('panelStyle')){$("#id"+data.id).attr("style",data.panelStyle);}
|
if(data.type>=UPDATE_OFFSET&&data.type<UI_INITIAL_GUI){var element=$("#id"+data.id);if(data.hasOwnProperty('panelStyle')){$("#id"+data.id).attr("style",data.panelStyle);}
|
||||||
|
@ -906,6 +906,10 @@ void ESPUIClass::updateLabel(uint16_t id, const String& value)
|
|||||||
updateControlValue(id, value);
|
updateControlValue(id, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ESPUIClass::updateButton(uint16_t id, const String& value) {
|
||||||
|
updateControlValue(id, value);
|
||||||
|
}
|
||||||
|
|
||||||
void ESPUIClass::updateSlider(uint16_t id, int nValue, int clientId)
|
void ESPUIClass::updateSlider(uint16_t id, int nValue, int clientId)
|
||||||
{
|
{
|
||||||
updateControlValue(id, String(nValue), clientId);
|
updateControlValue(id, String(nValue), clientId);
|
||||||
|
@ -279,6 +279,7 @@ public:
|
|||||||
|
|
||||||
void print(uint16_t id, const String& value);
|
void print(uint16_t id, const String& value);
|
||||||
void updateLabel(uint16_t id, const String& value);
|
void updateLabel(uint16_t id, const String& value);
|
||||||
|
void updateButton(uint16_t id, const String& value);
|
||||||
void updateSwitcher(uint16_t id, bool nValue, int clientId = -1);
|
void updateSwitcher(uint16_t id, bool nValue, int clientId = -1);
|
||||||
void updateSlider(uint16_t id, int nValue, int clientId = -1);
|
void updateSlider(uint16_t id, int nValue, int clientId = -1);
|
||||||
void updateNumber(uint16_t id, int nValue, int clientId = -1);
|
void updateNumber(uint16_t id, int nValue, int clientId = -1);
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user