fix(color): momentaryButton in Lua script crashes radio (#6460)

This commit is contained in:
philmoz
2025-07-25 09:52:42 +10:00
committed by GitHub
parent fd831e6fb9
commit d721aa9653
2 changed files with 33 additions and 15 deletions
+26 -13
View File
@@ -1791,19 +1791,6 @@ void LvglWidgetTextButtonBase::clearRefs(lua_State *L)
LvglWidgetObject::clearRefs(L);
}
void LvglWidgetTextButtonBase::setText(const char *s)
{
if (window && txt.changedText(s)) {
((TextButton *)window)->setText(s);
}
}
void LvglWidgetTextButtonBase::setFont(LcdFlags newFont)
{
if (window && font.changedFont(newFont))
((TextButton*)window)->setFont(FONT_INDEX(font.flags));
}
void LvglWidgetTextButtonBase::setSize(coord_t w, coord_t h)
{
if (w == LV_SIZE_CONTENT || w == 0) w = lv_obj_get_width(window->getLvObj());
@@ -1859,6 +1846,19 @@ void LvglWidgetTextButton::setChecked(bool checked)
((TextButton*)window)->check(checked);
}
void LvglWidgetTextButton::setText(const char *s)
{
if (window && txt.changedText(s)) {
((TextButton *)window)->setText(s);
}
}
void LvglWidgetTextButton::setFont(LcdFlags newFont)
{
if (window && font.changedFont(newFont))
((TextButton*)window)->setFont(FONT_INDEX(font.flags));
}
void LvglWidgetTextButton::build(lua_State *L)
{
if (h == LV_SIZE_CONTENT) h = 0;
@@ -1896,6 +1896,19 @@ void LvglWidgetMomentaryButton::clearRefs(lua_State *L)
LvglWidgetTextButtonBase::clearRefs(L);
}
void LvglWidgetMomentaryButton::setText(const char *s)
{
if (window && txt.changedText(s)) {
((MomentaryButton *)window)->setText(s);
}
}
void LvglWidgetMomentaryButton::setFont(LcdFlags newFont)
{
if (window && font.changedFont(newFont))
((MomentaryButton*)window)->setFont(FONT_INDEX(font.flags));
}
void LvglWidgetMomentaryButton::build(lua_State *L)
{
if (h == LV_SIZE_CONTENT) h = 0;