diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 1998-10-06 18:21:25 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 1998-10-06 18:21:25 +0000 |
| commit | f9039b2ae21988783feae9b362818e7923e82d14 (patch) | |
| tree | 6d6fe3679d73448758f9794e7d4d4f6b22a4adad /test/file_chooser.cxx | |
| parent | 67e89232f9ba067825a158734a09e0fa21aacbe3 (diff) | |
Initial revision
git-svn-id: file:///fltk/svn/fltk/trunk@2 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/file_chooser.cxx')
| -rw-r--r-- | test/file_chooser.cxx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/file_chooser.cxx b/test/file_chooser.cxx new file mode 100644 index 000000000..e2b366ce2 --- /dev/null +++ b/test/file_chooser.cxx @@ -0,0 +1,36 @@ +/* Test fl_file_chooser() */ + +#include <FL/Fl.H> +#include <FL/Fl_Button.H> +#include <FL/Fl_Window.H> +#include <FL/Fl_Input.H> +#include <FL/fl_file_chooser.H> +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +Fl_Input *pattern, *current; + +void pickfile(Fl_Widget *) { + const char *p; + p = fl_file_chooser("Pick a file",pattern->value(),current->value()); + if (p) current->value(p); +} + +void thecb(const char *name) { + printf("Callback '%s'\n",name); +} + +int main(int argc, char **argv) { + Fl_Window window(400,200); + pattern = new Fl_Input(100,50,280,30,"Pattern:"); + pattern->static_value("*"); + current = new Fl_Input(100,90,280,30,"Current:"); + Fl_Button button(100,120,100,30,"&Choose file"); + button.callback(pickfile); + window.end(); + window.show(argc, argv); + fl_file_chooser_callback(thecb); + return Fl::run(); +} |
