summaryrefslogtreecommitdiff
path: root/examples/table-with-keynav.cxx
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2013-03-25 23:20:29 +0000
committerGreg Ercolano <erco@seriss.com>2013-03-25 23:20:29 +0000
commitb2a54c36793e3a843a3eb07f6cae831b3f9a215d (patch)
tree0064ce8c16bdd8744af93330464c05aa79b684c2 /examples/table-with-keynav.cxx
parent449f36b6f8daf367b0c3be3f496b1b191e71adcb (diff)
o Fixed tab navigation problem with this demo
o Prevent Fl_Output from erasing if value unchanged (allows text selection and keyboard nav of the Fl_Output widget..) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9848 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'examples/table-with-keynav.cxx')
-rw-r--r--examples/table-with-keynav.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/table-with-keynav.cxx b/examples/table-with-keynav.cxx
index b18a0e304..74be7e30c 100644
--- a/examples/table-with-keynav.cxx
+++ b/examples/table-with-keynav.cxx
@@ -30,6 +30,7 @@
#include <FL/Fl_Toggle_Button.H>
#include <FL/Fl_Output.H>
#include <FL/Fl_Table_Row.H>
+#include <FL/names.h>
#include <stdio.h>
#include <stdlib.h>
@@ -115,8 +116,9 @@ public:
int sum = GetSelectionSum();
if ( sum == -1 ) { sprintf(s, "(nothing selected)"); G_sum->color(48); }
else { sprintf(s, "%d", sum); G_sum->color(FL_WHITE); }
- G_sum->value(s);
- G_sum->redraw();
+ // Update only if different (lets one copy/paste from sum)
+ if ( strcmp(s,G_sum->value()))
+ { G_sum->value(s); G_sum->redraw(); }
}
// Keyboard and mouse events
int handle(int e) {
@@ -128,9 +130,9 @@ public:
case FL_KEYUP:
case FL_KEYDOWN:
case FL_DRAG: {
+ //ret = 1; // *don't* indicate we 'handled' these, just update ('handling' prevents e.g. tab nav)
UpdateSum();
redraw();
- ret = 1;
break;
}
case FL_FOCUS: // tells FLTK we're interested in keyboard events