summaryrefslogtreecommitdiff
path: root/test/ask.cxx
diff options
context:
space:
mode:
authorFabien Costantini <fabien@onepost.net>2008-10-04 12:00:16 +0000
committerFabien Costantini <fabien@onepost.net>2008-10-04 12:00:16 +0000
commit5fcfaa2fa1e2552077c9c059540f9c153664d2bc (patch)
tree3acae30d2269014164dd7ad595f3a95b3e63e0ce /test/ask.cxx
parent727b50652cc53e27e6113f1420206ceac0b89146 (diff)
Doxygen documentation: more paranoid fixes and complements in common dialogs. Added new test cases in the ask demo now featuring fl_message() and fl_password() API, made fl_choice() more specific about its return value tests in caller (also added a third button).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6369 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/ask.cxx')
-rw-r--r--test/ask.cxx31
1 files changed, 23 insertions, 8 deletions
diff --git a/test/ask.cxx b/test/ask.cxx
index 7a9112bbf..c9c3f34cd 100644
--- a/test/ask.cxx
+++ b/test/ask.cxx
@@ -43,28 +43,43 @@
#include <FL/fl_ask.H>
#include <stdlib.h>
-void rename_me(Fl_Widget*o) {
- const char *input = fl_input("Input:", o->label());
-
+void update_input_text(Fl_Widget* o, const char *input) {
if (input) {
o->copy_label(input);
o->redraw();
}
}
+void rename_me(Fl_Widget*o) {
+ const char *input = fl_input("Input:", o->label());
+ update_input_text(o, input);
+}
+
+void rename_me_pwd(Fl_Widget*o) {
+ const char *input = fl_password("Input PWD:", o->label());
+ update_input_text(o, input);
+}
+
void window_callback(Fl_Widget*, void*) {
- if (!fl_choice("Are you sure you want to quit?", "Cancel", "Quit", 0L)) return;
- exit(0);
+ int rep = fl_choice("Are you sure you want to quit?",
+ "Cancel", "Quit", "Dunno");
+ if (rep==1)
+ exit(0);
+ else if (rep==2)
+ fl_message("Well, maybe you should know before we quit.");
}
int main(int argc, char **argv) {
- char buffer[128] = "test text";
+ char buffer[128] = "Test text";
+ char buffer2[128] = "MyPassword";
// this is a test to make sure automatic destructors work. Pop up
-// the question dialog several times and make sure it don't crash.
+// the question dialog several times and make sure it doesn't crash.
+// fc: added more fl_ask common dialogs for test cases purposes.
- Fl_Window window(200, 55);
+ Fl_Window window(200, 105);
Fl_Return_Button b(20, 10, 160, 35, buffer); b.callback(rename_me);
+ Fl_Button b2(20, 50, 160, 35, buffer2); b2.callback(rename_me_pwd);
window.end();
window.resizable(&b);
window.show(argc, argv);