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
This commit is contained in:
Greg Ercolano 2010-12-21 02:37:41 +00:00
parent a8e8831559
commit 99fe2b88e7
2 changed files with 27 additions and 2 deletions

View File

@ -35,6 +35,7 @@
#include <FL/Fl_Multiline_Input.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Toggle_Button.H>
#include <FL/Fl_Light_Button.H>
#include <FL/Fl_Color_Chooser.H>
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");

View File

@ -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: