fix(color): model setup and logical switch monitor may not display correctly (#7431)
This commit is contained in:
@@ -102,6 +102,12 @@ void ButtonBase::checkEvents()
|
||||
if (checkHandler) checkHandler();
|
||||
}
|
||||
|
||||
void ButtonBase::setCheckHandler(std::function<void(void)> handler)
|
||||
{
|
||||
checkHandler = std::move(handler);
|
||||
if (checkHandler) checkHandler();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
TextButton::TextButton(Window* parent, const rect_t& rect, std::string text,
|
||||
|
||||
@@ -54,10 +54,7 @@ class ButtonBase : public FormField
|
||||
longPressHandler = std::move(handler);
|
||||
}
|
||||
|
||||
void setCheckHandler(std::function<void(void)> handler)
|
||||
{
|
||||
checkHandler = std::move(handler);
|
||||
}
|
||||
void setCheckHandler(std::function<void(void)> handler);
|
||||
|
||||
protected:
|
||||
std::function<uint8_t(void)> pressHandler;
|
||||
|
||||
@@ -98,8 +98,7 @@ FileChoice::FileChoice(Window *parent, const rect_t &rect, const std::string fol
|
||||
std::function<std::string()> getValue,
|
||||
std::function<void(std::string)> setValue,
|
||||
bool stripExtension, const char *title) :
|
||||
Choice(
|
||||
parent, rect, 0, 0, [=]() { return selectedIdx; },
|
||||
Choice(parent, rect, 0, 0, nullptr,
|
||||
[=](int val) { setValue(getString(val)); selectedIdx = val; }, title, CHOICE_TYPE_FOLDER),
|
||||
folder(std::move(folder)),
|
||||
extension(std::move(extension)),
|
||||
@@ -107,6 +106,8 @@ FileChoice::FileChoice(Window *parent, const rect_t &rect, const std::string fol
|
||||
getValue(std::move(getValue)),
|
||||
stripExtension(stripExtension)
|
||||
{
|
||||
// getValue function set here to ensure selectedIdx is set before use
|
||||
setGetValueHandler([=]() { return selectedIdx; });
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
@@ -487,7 +487,7 @@ void ModelFlightModesPage::build(Window* form)
|
||||
|
||||
btn->setPressHandler([=]() {
|
||||
(new FlightModeEdit(i))->setCloseHandler([=]() { btn->refresh(); });
|
||||
return 0;
|
||||
return btn->isActive();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -182,10 +182,10 @@ class InputLineButton : public InputMixButtonBase
|
||||
}
|
||||
}
|
||||
|
||||
bool isActive() const override { return isExpoActive(index); }
|
||||
|
||||
protected:
|
||||
Messaging refreshMsg;
|
||||
|
||||
bool isActive() const override { return isExpoActive(index); }
|
||||
};
|
||||
|
||||
class InputGroup : public InputMixGroupBase
|
||||
@@ -277,7 +277,7 @@ InputMixButtonBase* ModelInputsPage::createLineButton(InputMixGroupBase* group,
|
||||
uint8_t idx = button->getIndex();
|
||||
deleteInput(idx);
|
||||
});
|
||||
return 0;
|
||||
return button->isActive();
|
||||
});
|
||||
|
||||
return button;
|
||||
|
||||
@@ -620,7 +620,7 @@ void ModelLogicalSwitchesPage::build(Window* window)
|
||||
storageDirty(EE_MODEL);
|
||||
rebuild(window);
|
||||
});
|
||||
return 0;
|
||||
return button->isActive();
|
||||
});
|
||||
|
||||
if (focusIndex == i) {
|
||||
|
||||
@@ -164,12 +164,12 @@ class MixLineButton : public InputMixButtonBase
|
||||
}
|
||||
}
|
||||
|
||||
bool isActive() const override { return isMixActive(index); }
|
||||
|
||||
static LAYOUT_VAL_SCALED(MPLEX_XO, 28)
|
||||
|
||||
protected:
|
||||
MPlexIcon* mplex = nullptr;
|
||||
|
||||
bool isActive() const override { return isMixActive(index); }
|
||||
};
|
||||
|
||||
class MixGroup : public InputMixGroupBase
|
||||
@@ -301,7 +301,7 @@ InputMixButtonBase* ModelMixesPage::createLineButton(InputMixGroupBase *group, u
|
||||
uint8_t idx = button->getIndex();
|
||||
deleteMix(idx);
|
||||
});
|
||||
return 0;
|
||||
return button->isActive();
|
||||
});
|
||||
|
||||
return button;
|
||||
|
||||
Reference in New Issue
Block a user