Focus issue on disabled form fields
This commit is contained in:
@@ -59,7 +59,7 @@ void CurveEdit::update()
|
||||
bool CurveEdit::onTouchEnd(coord_t x, coord_t y)
|
||||
{
|
||||
if (!hasFocus()) {
|
||||
setFocus();
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
|
||||
CurveKeyboard::show(this, isCustomCurve());
|
||||
|
||||
@@ -42,7 +42,7 @@ FullScreenDialog::FullScreenDialog(uint8_t type, std::string title, std::string
|
||||
});
|
||||
#endif
|
||||
bringToTop();
|
||||
setFocus();
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
|
||||
void FullScreenDialog::paint(BitmapBuffer * dc)
|
||||
@@ -117,7 +117,7 @@ void FullScreenDialog::deleteLater()
|
||||
{
|
||||
#if !defined(HARDWARE_TOUCH)
|
||||
if (previousFocus) {
|
||||
previousFocus->setFocus();
|
||||
previousFocus->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class GVarNumberEdit: public FormGroup
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
switchGVarMode();
|
||||
field->setFocus();
|
||||
field->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
else {
|
||||
FormGroup::onEvent(event);
|
||||
|
||||
@@ -311,7 +311,7 @@ void ModelCurvesPage::build(FormWindow * window, int8_t focusIndex)
|
||||
});
|
||||
|
||||
if (focusIndex == index) {
|
||||
button->setFocus();
|
||||
button->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
|
||||
grid.spacer(button->height() + 5);
|
||||
|
||||
@@ -404,7 +404,7 @@ void ModelInputsPage::build(FormWindow * window, int8_t focusIndex)
|
||||
while (inputIndex < MAX_EXPOS && line->chn == input && EXPO_VALID(line)) {
|
||||
Button * button = new InputLineButton(window, grid.getFieldSlot(), inputIndex);
|
||||
if (focusIndex == inputIndex)
|
||||
button->setFocus();
|
||||
button->setFocus(SET_FOCUS_DEFAULT);
|
||||
button->setPressHandler([=]() -> uint8_t {
|
||||
button->bringToTop();
|
||||
Menu * menu = new Menu(window);
|
||||
@@ -465,7 +465,7 @@ void ModelInputsPage::build(FormWindow * window, int8_t focusIndex)
|
||||
else {
|
||||
auto button = new TextButton(window, grid.getLabelSlot(), getSourceString(MIXSRC_FIRST_INPUT + input));
|
||||
if (focusIndex == inputIndex)
|
||||
button->setFocus();
|
||||
button->setFocus(SET_FOCUS_DEFAULT);
|
||||
button->setPressHandler([=]() -> uint8_t {
|
||||
button->bringToTop();
|
||||
Menu * menu = new Menu(window);
|
||||
|
||||
@@ -389,7 +389,7 @@ void ModelLogicalSwitchesPage::build(FormWindow * window, int8_t focusIndex)
|
||||
});
|
||||
|
||||
if (focusIndex == i) {
|
||||
button->setFocus();
|
||||
button->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
|
||||
grid.spacer(button->height() + 5);
|
||||
|
||||
@@ -335,7 +335,7 @@ void ModelMixesPage::build(FormWindow * window, int8_t focusMixIndex)
|
||||
while (mixIndex < MAX_MIXERS && mix->srcRaw > 0 && mix->destCh == ch) {
|
||||
Button * button = new MixLineButton(window, grid.getFieldSlot(), mixIndex);
|
||||
if (focusMixIndex == mixIndex)
|
||||
button->setFocus();
|
||||
button->setFocus(SET_FOCUS_DEFAULT);
|
||||
button->setPressHandler([=]() -> uint8_t {
|
||||
button->bringToTop();
|
||||
Menu * menu = new Menu(window);
|
||||
@@ -399,7 +399,7 @@ void ModelMixesPage::build(FormWindow * window, int8_t focusMixIndex)
|
||||
else {
|
||||
auto button = new TextButton(window, grid.getLabelSlot(), getSourceString(MIXSRC_CH1 + ch));
|
||||
if (focusMixIndex == mixIndex)
|
||||
button->setFocus();
|
||||
button->setFocus(SET_FOCUS_DEFAULT);
|
||||
button->setPressHandler([=]() -> uint8_t {
|
||||
button->bringToTop();
|
||||
Menu * menu = new Menu(window);
|
||||
|
||||
@@ -205,7 +205,7 @@ void ModelOutputsPage::build(FormWindow * window, int8_t focusChannel)
|
||||
});
|
||||
|
||||
if (focusChannel == ch) {
|
||||
button->setFocus();
|
||||
button->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
|
||||
grid.spacer(button->height() + 5);
|
||||
|
||||
@@ -310,13 +310,13 @@ class ModelCategoryPageBody: public FormWindow {
|
||||
}
|
||||
}
|
||||
else {
|
||||
button->setFocus();
|
||||
button->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
|
||||
if (selected == index) {
|
||||
button->setFocus();
|
||||
button->setFocus(SET_FOCUS_DEFAULT);
|
||||
footer->setCurrentModel(model);
|
||||
}
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ class RegisterDialog: public Dialog {
|
||||
this->deleteLater();
|
||||
return 0;
|
||||
});
|
||||
exitButton->setFocus();
|
||||
exitButton->setFocus(SET_FOCUS_DEFAULT);
|
||||
grid.nextLine();
|
||||
grid.spacer(PAGE_PADDING);
|
||||
|
||||
@@ -239,7 +239,7 @@ class RegisterDialog: public Dialog {
|
||||
FormField::link(uid, rxName);
|
||||
FormField::link(rxName, okButton);
|
||||
FormField::link(okButton, exitButton);
|
||||
okButton->setFocus();
|
||||
okButton->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
else if (reusableBuffer.moduleSetup.pxx2.registerStep == REGISTER_OK) {
|
||||
deleteLater();
|
||||
@@ -467,7 +467,7 @@ class TrainerModuleWindow : public FormGroup {
|
||||
g_model.trainerData.mode = newValue;
|
||||
update();
|
||||
SET_DIRTY();
|
||||
moduleChoice->setFocus();
|
||||
moduleChoice->setFocus(SET_FOCUS_DEFAULT);
|
||||
});
|
||||
moduleChoice->setAvailableHandler(isTrainerModeAvailable);
|
||||
grid.nextLine();
|
||||
@@ -595,7 +595,7 @@ class ModuleWindow : public FormGroup {
|
||||
SET_DIRTY();
|
||||
// TODO resetModuleSettings(moduleIdx);
|
||||
update();
|
||||
moduleChoice->setFocus();
|
||||
moduleChoice->setFocus(SET_FOCUS_DEFAULT);
|
||||
});
|
||||
moduleChoice->setAvailableHandler([=](int8_t moduleType) {
|
||||
return moduleIdx == INTERNAL_MODULE ? isInternalModuleAvailable(moduleType) : isExternalModuleAvailable(moduleType);
|
||||
@@ -620,7 +620,7 @@ class ModuleWindow : public FormGroup {
|
||||
g_model.moduleData[moduleIdx].subType = newValue;
|
||||
SET_DIRTY();
|
||||
update();
|
||||
rfChoice->setFocus();
|
||||
rfChoice->setFocus(SET_FOCUS_DEFAULT);
|
||||
});
|
||||
}
|
||||
else if (isModulePXX2(moduleIdx)) {
|
||||
@@ -630,7 +630,7 @@ class ModuleWindow : public FormGroup {
|
||||
g_model.moduleData[moduleIdx].subType = newValue;
|
||||
SET_DIRTY();
|
||||
update();
|
||||
rfChoice->setFocus();
|
||||
rfChoice->setFocus(SET_FOCUS_DEFAULT);
|
||||
});
|
||||
}
|
||||
#if defined(MULTIMODULE)
|
||||
@@ -647,7 +647,7 @@ class ModuleWindow : public FormGroup {
|
||||
resetMultiProtocolsOptions(moduleIdx);
|
||||
SET_DIRTY();
|
||||
update();
|
||||
rfChoice->setFocus();
|
||||
rfChoice->setFocus(SET_FOCUS_DEFAULT);
|
||||
});
|
||||
|
||||
if (g_model.moduleData[moduleIdx].multi.customProto) {
|
||||
@@ -833,7 +833,7 @@ class ModuleWindow : public FormGroup {
|
||||
g_model.moduleData[moduleIdx].failsafeMode = newValue;
|
||||
SET_DIRTY();
|
||||
update();
|
||||
failSafeChoice->setFocus();
|
||||
failSafeChoice->setFocus(SET_FOCUS_DEFAULT);
|
||||
});
|
||||
if (g_model.moduleData[moduleIdx].failsafeMode == FAILSAFE_CUSTOM) {
|
||||
new TextButton(this, grid.getFieldSlot(2, 1), STR_SET,
|
||||
|
||||
@@ -467,7 +467,7 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
|
||||
return 0;
|
||||
});
|
||||
if (focusSensorIndex == idx) {
|
||||
button->setFocus();
|
||||
button->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
grid.nextLine();
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ Page::~Page()
|
||||
void Page::deleteLater()
|
||||
{
|
||||
if (previousFocus) {
|
||||
previousFocus->setFocus();
|
||||
previousFocus->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
|
||||
Window::deleteLater();
|
||||
|
||||
@@ -104,7 +104,7 @@ RadioCalibrationPage::RadioCalibrationPage(bool initial):
|
||||
{
|
||||
buildHeader(&header);
|
||||
buildBody(&body);
|
||||
setFocus();
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
|
||||
void RadioCalibrationPage::buildHeader(Window * window)
|
||||
|
||||
@@ -66,5 +66,5 @@ RadioAnalogsDiagsPage::RadioAnalogsDiagsPage():
|
||||
{
|
||||
buildHeader(&header);
|
||||
buildBody(&body);
|
||||
setFocus();
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
|
||||
@@ -126,5 +126,5 @@ RadioKeyDiagsPage::RadioKeyDiagsPage() :
|
||||
{
|
||||
buildHeader(&header);
|
||||
buildBody(&body);
|
||||
setFocus();
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class BluetoothConfigWindow : public FormGroup
|
||||
g_eeGeneral.bluetoothMode = newValue;
|
||||
update();
|
||||
SET_DIRTY();
|
||||
btMode->setFocus();
|
||||
btMode->setFocus(SET_FOCUS_DEFAULT);
|
||||
});
|
||||
grid.nextLine();
|
||||
|
||||
@@ -158,7 +158,7 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
calib->setPressHandler([=]() -> uint8_t {
|
||||
auto calibrationPage = new RadioCalibrationPage();
|
||||
calibrationPage->setCloseHandler([=]() {
|
||||
calib->setFocus();
|
||||
calib->setFocus(SET_FOCUS_DEFAULT);
|
||||
});
|
||||
return 0;
|
||||
});
|
||||
@@ -254,7 +254,7 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
debugAnas->setPressHandler([=]() -> uint8_t {
|
||||
auto debugAnalogsPage = new RadioAnalogsDiagsPage();
|
||||
debugAnalogsPage->setCloseHandler([=]() {
|
||||
calib->setFocus();
|
||||
calib->setFocus(SET_FOCUS_DEFAULT);
|
||||
});
|
||||
return 0;
|
||||
});
|
||||
@@ -263,7 +263,7 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
debugKeys->setPressHandler([=]() -> uint8_t {
|
||||
auto debugKeysPage = new RadioKeyDiagsPage();
|
||||
debugKeysPage->setCloseHandler([=]() {
|
||||
calib->setFocus();
|
||||
calib->setFocus(SET_FOCUS_DEFAULT);
|
||||
});
|
||||
return 0;
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ class SpectrumFooterWindow: public FormGroup
|
||||
SET_VALUE(reusableBuffer.spectrumAnalyser.track, newValue * 1000000));
|
||||
tracker->setSuffix("MHz");
|
||||
tracker->setPrefix("T: ");
|
||||
tracker->setFocus();
|
||||
tracker->setFocus(SET_FOCUS_DEFAULT);
|
||||
|
||||
if (isModuleMultimodule(moduleIdx)) {
|
||||
char label[10];
|
||||
|
||||
@@ -100,7 +100,7 @@ class LayoutChoice: public FormField {
|
||||
|
||||
menu->setCloseHandler([=]() {
|
||||
editMode = false;
|
||||
setFocus();
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ void SourceChoice::openMenu()
|
||||
menu->setToolbar(new SourceChoiceMenuToolbar(this, menu));
|
||||
menu->setCloseHandler([=]() {
|
||||
editMode = false;
|
||||
setFocus();
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ void SourceChoice::onEvent(event_t event)
|
||||
bool SourceChoice::onTouchEnd(coord_t, coord_t)
|
||||
{
|
||||
openMenu();
|
||||
setFocus();
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
setEditMode(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -480,7 +480,7 @@ void SpecialFunctionsPage::build(FormWindow * window, int8_t focusIndex)
|
||||
});
|
||||
|
||||
if (focusIndex == i) {
|
||||
button->setFocus();
|
||||
button->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
|
||||
grid.spacer(button->height() + 5);
|
||||
|
||||
@@ -93,7 +93,7 @@ void SwitchChoice::openMenu()
|
||||
menu->setToolbar(new SwitchChoiceMenuToolbar(this, menu));
|
||||
menu->setCloseHandler([=]() {
|
||||
editMode = false;
|
||||
setFocus();
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ void SwitchChoice::onEvent(event_t event)
|
||||
bool SwitchChoice::onTouchEnd(coord_t, coord_t)
|
||||
{
|
||||
openMenu();
|
||||
setFocus();
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
setEditMode(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ void TabsGroup::setVisibleTab(PageTab * tab)
|
||||
currentTab = tab;
|
||||
tab->build(&body);
|
||||
if (!focusWindow)
|
||||
setFocus();
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
header.setTitle(tab->title.c_str());
|
||||
invalidate();
|
||||
}
|
||||
@@ -170,7 +170,7 @@ void TabsGroup::onEvent(event_t event)
|
||||
}
|
||||
else if (event == EVT_KEY_LONG(KEY_EXIT) || event == EVT_KEY_BREAK(KEY_EXIT)) {
|
||||
killEvents(event);
|
||||
ViewMain::instance->setFocus();
|
||||
ViewMain::instance->setFocus(SET_FOCUS_DEFAULT);
|
||||
deleteLater();
|
||||
}
|
||||
else if (parent) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "strhelpers.h"
|
||||
|
||||
TimeEdit::TimeEdit(Window * parent, const rect_t & rect, int32_t vmin, int32_t vmax, std::function<int32_t()> getValue, std::function<void(int32_t)> setValue):
|
||||
BaseNumberEdit(parent, rect, vmin, vmax, getValue, setValue)
|
||||
BaseNumberEdit(parent, rect, vmin, vmax, std::move(getValue), std::move(setValue))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ void TimeEdit::onEvent(event_t event)
|
||||
bool TimeEdit::onTouchEnd(coord_t x, coord_t y)
|
||||
{
|
||||
if (!hasFocus()) {
|
||||
setFocus();
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
|
||||
// NumberKeyboard * keyboard = NumberKeyboard::instance();
|
||||
|
||||
Reference in New Issue
Block a user