Fixes
This commit is contained in:
+5
-6
@@ -122,6 +122,9 @@ void FormGroup::addField(FormField * field, bool front)
|
||||
if (!focusWindow && !(field->getWindowFlags() & FORM_FORWARD_FOCUS)) {
|
||||
field->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
else if (focusWindow == this && (windowFlags & FORM_FORWARD_FOCUS)) {
|
||||
field->setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
void FormGroup::setFocus(uint8_t flag)
|
||||
@@ -212,11 +215,7 @@ void FormGroup::onEvent(event_t event)
|
||||
first->setFocus(SET_FOCUS_FIRST);
|
||||
}
|
||||
else if (event == EVT_KEY_BREAK(KEY_EXIT) && !hasFocus() && !(windowFlags & FORM_FORWARD_FOCUS)) {
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
#else
|
||||
FormField::onEvent(event);
|
||||
#endif
|
||||
setFocus(SET_FOCUS_DEFAULT); // opentx - model - timers settings
|
||||
}
|
||||
else if (event == EVT_ROTARY_RIGHT && !next) {
|
||||
if (first)
|
||||
@@ -249,7 +248,7 @@ void FormWindow::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("FormWindow").c_str(), event);
|
||||
|
||||
if (event == EVT_KEY_BREAK(KEY_EXIT) && first) {
|
||||
if (event == EVT_KEY_BREAK(KEY_EXIT) && (windowFlags & FORM_FORWARD_FOCUS) && first) {
|
||||
Window * currentFocus = getFocus();
|
||||
first->setFocus(SET_FOCUS_FIRST);
|
||||
if (getFocus() != currentFocus)
|
||||
|
||||
+2
-2
@@ -105,11 +105,11 @@ void MenuBody::paint(BitmapBuffer * dc)
|
||||
}
|
||||
}
|
||||
if (line.drawLine) {
|
||||
line.drawLine(dc, 0, i * MENUS_LINE_HEIGHT /*+ (lineHeight - 20) / 2*/, flags);
|
||||
line.drawLine(dc, 0, i * MENUS_LINE_HEIGHT, flags);
|
||||
}
|
||||
else {
|
||||
const char * text = line.text.data();
|
||||
dc->drawText(10, i * MENUS_LINE_HEIGHT + (MENUS_LINE_HEIGHT - 20) / 2, text[0] == '\0' ? "---" : text, flags);
|
||||
dc->drawText(10, i * MENUS_LINE_HEIGHT + (MENUS_LINE_HEIGHT - getFontHeight(MENU_FONT)) / 2, text[0] == '\0' ? "---" : text, flags);
|
||||
}
|
||||
|
||||
Menu * menu = getParentMenu();
|
||||
|
||||
+8
-2
@@ -20,9 +20,9 @@
|
||||
#ifndef _TABLE_H_
|
||||
#define _TABLE_H_
|
||||
|
||||
#include "form.h"
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "form.h"
|
||||
#include "libopenui_config.h"
|
||||
|
||||
class Table: public FormField {
|
||||
@@ -87,6 +87,9 @@ class Table: public FormField {
|
||||
{
|
||||
lines.push_back(line);
|
||||
setInnerHeight(lines.size() * TABLE_LINE_HEIGHT - 2);
|
||||
if (hasFocus() && selection < 0) {
|
||||
select(0, true);
|
||||
}
|
||||
}
|
||||
|
||||
void setLineFlags(uint8_t index, LcdFlags flags)
|
||||
@@ -147,6 +150,9 @@ class Table: public FormField {
|
||||
header(this, {0, 0, width(), 0}, columnsCount),
|
||||
body(this, {0, 0, width(), height()}, windowFlags)
|
||||
{
|
||||
if (hasFocus()) {
|
||||
setFocus(SET_FOCUS_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
@@ -182,7 +188,7 @@ class Table: public FormField {
|
||||
|
||||
void setFocus(uint8_t flag) override
|
||||
{
|
||||
if (body.selection < 0) {
|
||||
if (body.selection < 0 && !body.lines.empty()) {
|
||||
select(0);
|
||||
}
|
||||
body.setFocus(flag);
|
||||
|
||||
Reference in New Issue
Block a user