Form field: re-implemented enable/disable
This commit is contained in:
+14
@@ -48,6 +48,20 @@ void FormField::setEditMode(bool newEditMode)
|
|||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FormField::enable(bool value)
|
||||||
|
{
|
||||||
|
if (value) {
|
||||||
|
lv_obj_clear_state(lvobj, LV_STATE_DISABLED);
|
||||||
|
} else {
|
||||||
|
lv_obj_add_state(lvobj, LV_STATE_DISABLED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FormField::isEnabled() const
|
||||||
|
{
|
||||||
|
return !lv_obj_has_state(lvobj, LV_STATE_DISABLED);
|
||||||
|
}
|
||||||
|
|
||||||
void FormField::onClicked()
|
void FormField::onClicked()
|
||||||
{
|
{
|
||||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||||
|
|||||||
+2
-8
@@ -52,14 +52,8 @@ class FormField : public Window
|
|||||||
inline bool isEditMode() const { return editMode; }
|
inline bool isEditMode() const { return editMode; }
|
||||||
virtual void setEditMode(bool newEditMode);
|
virtual void setEditMode(bool newEditMode);
|
||||||
|
|
||||||
// TODO: replace with LVGL flags
|
bool isEnabled() const;
|
||||||
void enable(bool value = true)
|
void enable(bool value = true);
|
||||||
{
|
|
||||||
enabled = value;
|
|
||||||
invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isEnabled() const { return enabled; }
|
|
||||||
void disable() { enable(false); }
|
void disable() { enable(false); }
|
||||||
|
|
||||||
void onFocusLost() override
|
void onFocusLost() override
|
||||||
|
|||||||
Reference in New Issue
Block a user