diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-08-30 16:58:16 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-08-30 16:58:16 +0000 |
| commit | ec494401c1dc11b3d8adbbd8134ec497b4bff922 (patch) | |
| tree | 2d64ead928f3ad3f4dca4de60ad4594b3f882076 /test | |
| parent | 047c32c334ae7b2534959a9dac8cc31647d1d630 (diff) | |
Make sure all strings can be localized in the dialogs.
Move the "preview" button over so there is room for localization.
Fix the order of buttons in convenience dialogs.
Update "ask" to use the fl_input function.
Fix 4-bit BMP file loading.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2608 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test')
| -rw-r--r-- | test/ask.cxx | 56 |
1 files changed, 10 insertions, 46 deletions
diff --git a/test/ask.cxx b/test/ask.cxx index 8de2c3c35..8ad5a5aab 100644 --- a/test/ask.cxx +++ b/test/ask.cxx @@ -1,5 +1,5 @@ // -// "$Id: ask.cxx,v 1.4.2.3.2.1 2002/01/01 15:11:32 easysw Exp $" +// "$Id: ask.cxx,v 1.4.2.3.2.2 2002/08/30 16:58:16 easysw Exp $" // // Standard dialog test program for the Fast Light Tool Kit (FLTK). // @@ -38,48 +38,26 @@ #include <FL/Fl_Button.H> #include <FL/Fl_Return_Button.H> -int get_string(char*buffer) { - Fl_Window window(320,75); - Fl_Input input(60, 10, 250, 25, "Input:"); - input.value(buffer); - Fl_Button cancel(60, 40, 80, 25, "cancel"); - Fl_Return_Button ok(150, 40, 80, 25, "OK"); - window.hotspot(&cancel); // you must position modal windows - window.end(); - window.set_modal(); - window.show(); - for (;;) { - Fl::wait(); - Fl_Widget *o; - while ((o = Fl::readqueue())) { - if (o == &ok) { - strcpy(buffer,input.value()); - return 1; - } else if (o == &cancel || o == &window) { - return 0; - } - } - } -} +#include <FL/fl_ask.H> +#include <stdlib.h> void rename_me(Fl_Widget*o) { - if (get_string((char*)(o->label()))) o->redraw(); -} + const char *input = fl_input("Input:", o->label()); -#if 1 -#include <FL/fl_ask.H> -#include <stdlib.h> + if (input) { + o->label(input); + o->redraw(); + } +} void window_callback(Fl_Widget*, void*) { if (!fl_ask("Are you sure you want to quit?")) return; exit(0); } -#endif int main(int argc, char **argv) { char buffer[128] = "test text"; -#if 1 // this is a test to make sure automatic destructors work. Pop up // the question dialog several times and make sure it don't crash. @@ -93,22 +71,8 @@ int main(int argc, char **argv) { window.callback(window_callback); return Fl::run(); - -#else -// This is the demo as written in the documentation, it only creates -// the popup window once: - - if (get_string(buffer)) { - puts(buffer); - } else { - puts("cancel"); - } - return 0; - -#endif - } // -// End of "$Id: ask.cxx,v 1.4.2.3.2.1 2002/01/01 15:11:32 easysw Exp $". +// End of "$Id: ask.cxx,v 1.4.2.3.2.2 2002/08/30 16:58:16 easysw Exp $". // |
