summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2010-10-26 10:58:42 +0000
committerGreg Ercolano <erco@seriss.com>2010-10-26 10:58:42 +0000
commit347007964e5e0a131afa34bff3061dcafe24f021 (patch)
tree0a95b3a34ed700999f95ab76b5b7296060598714 /examples
parent0beca57ddfef2d55b416004675e5e67702df7b74 (diff)
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 git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7750 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'examples')
-rw-r--r--examples/table-with-keyboard-nav.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/table-with-keyboard-nav.cxx b/examples/table-with-keyboard-nav.cxx
index 855619e7b..f101a71de 100644
--- a/examples/table-with-keyboard-nav.cxx
+++ b/examples/table-with-keyboard-nav.cxx
@@ -248,8 +248,11 @@ void SingleInput::event_callback2() {
//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 @@ void SingleInput::event_callback2() {
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 @@ int main() {
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();