diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2008-12-26 21:20:38 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2008-12-26 21:20:38 +0000 |
| commit | fad309329b0ad830f3e423eaa5844e61d75e9210 (patch) | |
| tree | 4e77f876791f203cfe93f262e41994e1ae192e51 /test | |
| parent | 459cd78a947693d7fb99bf6ed0f497f2ae5cc1a5 (diff) | |
STR #2113: added sorting and a few other functions to Fl_Browser_.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6600 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test')
| -rw-r--r-- | test/browser.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/test/browser.cxx b/test/browser.cxx index 242b4caff..5e8b2927c 100644 --- a/test/browser.cxx +++ b/test/browser.cxx @@ -77,7 +77,8 @@ Fl_Button *top, *bottom, *middle, *visible, - *swap; + *swap, + *sort; Fl_Int_Input *field; void b_cb(Fl_Widget* o, void*) { @@ -117,12 +118,16 @@ void swap_cb(Fl_Widget *, void *) { browser->swap(a, b); // swap them } +void sort_cb(Fl_Widget *, void *) { + browser->sort(FL_SORT_ASC); +} + int main(int argc, char **argv) { int i; if (!Fl::args(argc,argv,i)) Fl::fatal(Fl::help); const char* fname = (i < argc) ? argv[i] : "browser.cxx"; - Fl_Window window(400,400,fname); - browser = new Fl_Select_Browser(0,0,400,350,0); + Fl_Window window(480,400,fname); + browser = new Fl_Select_Browser(0,0,480,350,0); browser->type(FL_MULTI_BROWSER); //browser->type(FL_HOLD_BROWSER); //browser->color(42); @@ -155,7 +160,7 @@ int main(int argc, char **argv) { } browser->position(0); - field = new Fl_Int_Input(50, 350, 350, 25, "Line #:"); + field = new Fl_Int_Input(50, 350, 430, 25, "Line #:"); field->callback(show_cb); top = new Fl_Button(0, 375, 80, 25, "Top"); @@ -174,6 +179,9 @@ int main(int argc, char **argv) { swap->callback(swap_cb); swap->tooltip("Swaps two selected lines\n(Use CTRL-click to select two lines)"); + sort = new Fl_Button(400, 375, 80, 25, "Sort"); + sort->callback(sort_cb); + window.resizable(browser); window.show(argc,argv); return Fl::run(); |
