From 5579dd81cc9984d13763edb2adbcb4b9bf39dc99 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Tue, 28 Dec 2010 20:28:44 +0000 Subject: Added some descriptive text for the example. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8133 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- examples/nativefilechooser-simple-app.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'examples') diff --git a/examples/nativefilechooser-simple-app.cxx b/examples/nativefilechooser-simple-app.cxx index 778f949e1..fefff28ea 100644 --- a/examples/nativefilechooser-simple-app.cxx +++ b/examples/nativefilechooser-simple-app.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include class Application : public Fl_Window { @@ -56,11 +57,14 @@ class Application : public Fl_Window { if ( !exist(filename) ) { FILE *fp = fopen(filename, "w"); // create file if it doesn't exist if ( fp ) { + // A real app would do something useful here. fprintf(fp, "Hello world.\n"); fclose(fp); } else { fl_message("Error: %s: %s", filename, strerror(errno)); } + } else { + // A real app would do something useful here. } } // Handle an 'Open' request from the menu @@ -124,6 +128,19 @@ public: menu->add("&File/&Save", FL_COMMAND+'s', save_cb, (void*)this); menu->add("&File/&Save As", 0, saveas_cb, (void*)this); menu->add("&File/&Quit", FL_COMMAND+'q', quit_cb); + // Describe the demo.. + Fl_Box *box = new Fl_Box(20,25+20,w()-40,h()-40-25); + box->color(45); + box->box(FL_FLAT_BOX); + box->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE|FL_ALIGN_WRAP); + box->label("This demo shows an example of implementing " + "common 'File' menu operations like:\n" + " File/Open, File/Save, File/Save As\n" + "..using the Fl_Native_File_Chooser widget.\n\n" + "Note 'Save' and 'Save As' really *does* create files! " + "This is to show how behavior differs when " + "files exist vs. do not."); + box->labelsize(12); // Initialize the file chooser fc = new Fl_Native_File_Chooser(); fc->filter("Text\t*.txt\n"); -- cgit v1.2.3