From 99fe2b88e7b4c5a342aa7345d920a970b53c1950 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Tue, 21 Dec 2010 02:37:41 +0000 Subject: Added "Tab Nav" and "Arrow Nav" toggle to the test/input program. Also, added tooltip to describe new "Arrow Nav" button in test/navigation program. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8090 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- test/input.cxx | 27 +++++++++++++++++++++++++-- test/navigation.cxx | 2 ++ 2 files changed, 27 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/input.cxx b/test/input.cxx index 428a65cb1..79a04ef22 100644 --- a/test/input.cxx +++ b/test/input.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include void cb(Fl_Widget *ob) { @@ -78,12 +79,23 @@ void color_cb(Fl_Widget* button, void* v) { } } +void tabnav_cb(Fl_Widget *w, void *v) { + Fl_Light_Button *b = (Fl_Light_Button*)w; + Fl_Multiline_Input *fmi = (Fl_Multiline_Input*)v; + fmi->tab_nav(b->value() ? 1 : 0); +} + +void arrownav_cb(Fl_Widget *w, void *v) { + Fl_Light_Button *b = (Fl_Light_Button*)w; + Fl::option(Fl::OPTION_ARROW_FOCUS, b->value() ? true : false); +} + int main(int argc, char **argv) { // the following two lines set the correct color scheme, so that // calling fl_contrast below will return good results Fl::args(argc, argv); Fl::get_system_colors(); - Fl_Window *window = new Fl_Window(400,400); + Fl_Window *window = new Fl_Window(400,420); int y = 10; input[0] = new Fl_Input(70,y,300,30,"Normal:"); y += 35; @@ -122,10 +134,21 @@ int main(int argc, char **argv) { b->callback(toggle_cb, FL_WHEN_NOT_CHANGED); y += 25; b->tooltip("Do callback even if the text is not changed"); y += 5; - b = new Fl_Button(10,y,200,25,"&print changed()"); + b = new Fl_Button(10,y,200,25,"&print changed()"); y += 25; b->callback(button_cb); b->tooltip("Print widgets that have changed() flag set"); + b = new Fl_Light_Button(10,y,100,25," Tab Nav"); + b->tooltip("Control tab navigation for the multiline input field"); + b->callback(tabnav_cb, (void*)input[4]); + b->value(input[4]->tab_nav() ? 1 : 0); + b = new Fl_Light_Button(110,y,100,25," Arrow Nav"); y += 25; + b->tooltip("Control horizontal arrow key focus navigation behavior.\n" + "e.g. Fl::OPTION_ARROW_FOCUS"); + b->callback(arrownav_cb); + b->value(input[4]->tab_nav() ? 1 : 0); + b->value(Fl::option(Fl::OPTION_ARROW_FOCUS) ? 1 : 0); + b = new Fl_Button(220,y1,100,25,"color"); y1 += 25; b->color(input[0]->color()); b->callback(color_cb, (void*)0); b->tooltip("Color behind the text"); diff --git a/test/navigation.cxx b/test/navigation.cxx index da7678424..99f081476 100644 --- a/test/navigation.cxx +++ b/test/navigation.cxx @@ -50,6 +50,8 @@ int main(int argc, char **argv) { Fl_Light_Button arrowfocus_butt(10,HEIGHT+10,130,20," Arrow Focus"); arrowfocus_butt.callback(ToggleArrowFocus_CB); arrowfocus_butt.value(Fl::option(Fl::OPTION_ARROW_FOCUS) ? 1 : 0); // use default + arrowfocus_butt.tooltip("Control horizontal arrow key focus navigation behavior.\n" + "e.g. Fl::OPTION_ARROW_FOCUS"); window.end(); // don't auto-add children for (int i = 0; i<10000; i++) { // make up a random size of widget: -- cgit v1.2.3