Author: greg.ercolano
Date: 2010-10-26 03:58:42 -0700 (Tue, 26 Oct 2010)
New Revision: 7750
Log:
Various fixes:
        o pre-selection of first cell
        o simplified input selection
        o Enabled ESC to quit app (original app did not handle it)
        o Ignore Fl_Tab to make tab navigation operate as expected



Modified:
   branches/branch-1.3/examples/table-with-keyboard-nav.cxx

Modified: branches/branch-1.3/examples/table-with-keyboard-nav.cxx
===================================================================
--- branches/branch-1.3/examples/table-with-keyboard-nav.cxx    2010-10-26 
10:39:19 UTC (rev 7749)
+++ branches/branch-1.3/examples/table-with-keyboard-nav.cxx    2010-10-26 
10:58:42 UTC (rev 7750)
@@ -248,8 +248,11 @@
          //FALLTHROUGH
 
        case FL_KEYBOARD:
-         if (Fl::event() == FL_KEYBOARD && Fl::e_length == 0) {
-           return;
+         if ( Fl::event_key() == FL_Escape )
+           exit(0);                            // ESC closes app
+         if (Fl::event() == FL_KEYBOARD && 
+            ( Fl::e_length == 0 || Fl::event_key() == FL_Tab) ) {
+           return;                             // ignore eg. keyboard nav keys
          }
          if (C == cols()-1 || R == rows()-1) return;
          if (input->visible()) input->do_callback();
@@ -262,8 +265,7 @@
          char s[30];
          sprintf(s, "%d", values[R][C]);
          input->value(s);
-         input->position(strlen(s));           // position cursor at end of 
string
-         input->mark(0);                       // pre-highlight (so typing 
replaces contents)
+         input->position(0,strlen(s));         // pre-highlight (so typing 
replaces contents)
          input->show();
          input->take_focus();
          if (Fl::event() == FL_KEYBOARD && Fl::e_text[0] != '\r') {
@@ -324,6 +326,7 @@
   table->col_resize(1);
   table->cols(11);
   table->col_width_all(70);
+  table->set_selection(0,0,0,0);       // select top/left cell
 
   // Add children to window
   win.begin();

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to