Form navigation issues + traces

This commit is contained in:
Bertrand Songis
2020-03-04 09:49:58 +01:00
parent bc1b1ee3a9
commit 7bb48f92b0
3 changed files with 10 additions and 10 deletions
+6 -6
View File
@@ -35,7 +35,7 @@ FormField::FormField(Window *parent, const rect_t & rect, WindowFlags windowFlag
#if defined(HARDWARE_KEYS)
void FormField::onEvent(event_t event)
{
TRACE_WINDOWS("%s received event 0x%X", FormField::getWindowDebugString("FormField").c_str(), event);
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("FormField").c_str(), event);
if (event == EVT_ROTARY_RIGHT/*EVT_KEY_BREAK(KEY_DOWN)*/) {
if (next) {
@@ -97,7 +97,7 @@ void FormGroup::addField(FormField * field)
void FormGroup::setFocus(uint8_t flag)
{
TRACE_WINDOWS("FormGroup::setFocus(%d)", flag);
TRACE_WINDOWS("%s setFocus(%d)", getWindowDebugString("FormGroup").c_str(), flag);
if (windowFlags & FORM_FORWARD_FOCUS) {
switch (flag) {
@@ -154,16 +154,16 @@ void FormGroup::onEvent(event_t event)
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("FormGroup").c_str(), event);
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
first->setFocus();
first->setFocus(SET_FOCUS_FIRST);
}
else if (event == EVT_KEY_BREAK(KEY_EXIT) && !hasFocus()) {
else if (event == EVT_KEY_BREAK(KEY_EXIT) && !hasFocus() && !(windowFlags & FORM_FORWARD_FOCUS)) {
setFocus(SET_FOCUS_DEFAULT);
}
else if (event == EVT_ROTARY_RIGHT && !next) {
first->setFocus();
first->setFocus(SET_FOCUS_FIRST);
}
else if (event == EVT_ROTARY_LEFT && !previous) {
last->setFocus();
last->setFocus(SET_FOCUS_FIRST);
}
else {
FormField::onEvent(event);
+2 -2
View File
@@ -209,11 +209,11 @@ void Window::fullPaint(BitmapBuffer * dc)
}
if (paintNeeded) {
TRACE_WINDOWS("%s", getWindowDebugString().c_str());
TRACE_WINDOWS_INDENT("%s", getWindowDebugString().c_str());
paint(dc);
}
else {
TRACE_WINDOWS("%s (skipped)", getWindowDebugString().c_str());
TRACE_WINDOWS_INDENT("%s (skipped)", getWindowDebugString().c_str());
}
if (!(windowFlags & NO_SCROLLBAR)) {
+2 -2
View File
@@ -87,9 +87,9 @@ class Window {
return result;
}
std::string getWindowDebugString(const char * name = nullptr)
std::string getWindowDebugString(const char * name = nullptr, bool indent = true)
{
return getIndentString() + getName() + (name ? std::string("/") + name : "") + " " + getRectString();
return getName() + (name ? std::string("[") + name + "]" : "") + " " + getRectString();
}
#endif