A form / form widget can avoid to have the focus

This commit is contained in:
Bertrand Songis
2019-10-21 12:08:06 +02:00
parent deef13e80c
commit 2214c54a05
2 changed files with 8 additions and 5 deletions
+2
View File
@@ -24,11 +24,13 @@
FormField::FormField(Window *parent, const rect_t & rect, WindowFlags windowFlags) : FormField::FormField(Window *parent, const rect_t & rect, WindowFlags windowFlags) :
Window(parent, rect, windowFlags) Window(parent, rect, windowFlags)
{ {
if (!(windowFlags & FORM_NO_FOCUS)) {
FormGroup * form = dynamic_cast<FormGroup *>(parent); FormGroup * form = dynamic_cast<FormGroup *>(parent);
if (form) { if (form) {
form->addField(this); form->addField(this);
} }
} }
}
#if defined(HARDWARE_KEYS) #if defined(HARDWARE_KEYS)
void FormField::onEvent(event_t event) void FormField::onEvent(event_t event)
+3 -2
View File
@@ -22,8 +22,9 @@
#include "window.h" #include "window.h"
constexpr WindowFlags FORM_FORWARD_FOCUS = WINDOW_FLAGS_LAST << 1; constexpr WindowFlags FORM_NO_FOCUS = WINDOW_FLAGS_LAST << 1;
constexpr WindowFlags FORM_DETACHED = WINDOW_FLAGS_LAST << 2; constexpr WindowFlags FORM_FORWARD_FOCUS = WINDOW_FLAGS_LAST << 2;
constexpr WindowFlags FORM_DETACHED = WINDOW_FLAGS_LAST << 3;
constexpr WindowFlags FORM_FLAGS_LAST = FORM_DETACHED; constexpr WindowFlags FORM_FLAGS_LAST = FORM_DETACHED;
class FormField: public Window { class FormField: public Window {