From b2a54c36793e3a843a3eb07f6cae831b3f9a215d Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Mon, 25 Mar 2013 23:20:29 +0000 Subject: 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 --- examples/table-with-keynav.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'examples') 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 #include #include +#include #include #include @@ -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 -- cgit v1.2.3