summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2010-12-28 20:28:44 +0000
committerGreg Ercolano <erco@seriss.com>2010-12-28 20:28:44 +0000
commit5579dd81cc9984d13763edb2adbcb4b9bf39dc99 (patch)
tree7f63f4cae5ec54375e21276fe75703504eb296b5 /examples
parentba29f189516fd71e016df9f05ba451f2b9064910 (diff)
Added some descriptive text for the example.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8133 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'examples')
-rw-r--r--examples/nativefilechooser-simple-app.cxx17
1 files changed, 17 insertions, 0 deletions
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 <FL/Fl_Window.H>
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_Native_File_Chooser.H>
+#include <FL/Fl_Box.H>
#include <FL/fl_ask.H>
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");