summaryrefslogtreecommitdiff
path: root/src/Fl_File_Chooser.cxx
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2020-07-10 21:49:00 -0700
committerAlbrecht Schlosser <albrechts.fltk@online.de>2020-07-14 12:52:56 +0200
commit0693c70f577624e66fd660a888f2d2bcd3fc180b (patch)
treee3b4161c0516ebacaf84e9b58852f48d4e4b6357 /src/Fl_File_Chooser.cxx
parent9925b0f12852dc37fb7fb773a525486c258d2c62 (diff)
First pass at fixing issue 99
A lot of code touched because low level functions needed to pass up error messages reliably, and this had to propagate up the entire driver hierarchy. Tested OK *in English* on: > Linux > OSX 10.10.x > Windows VS2017 > Windows mingw64 I have no way to test on Android, but it might work. TODO: Needs testing in other languages to verify proper UTF8 error messages, esp. with Windows VS, due to complexities with FormatMessage() -- see get_ms_errmsg()
Diffstat (limited to 'src/Fl_File_Chooser.cxx')
-rw-r--r--src/Fl_File_Chooser.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Fl_File_Chooser.cxx b/src/Fl_File_Chooser.cxx
index 8036ffaed..22fadf57f 100644
--- a/src/Fl_File_Chooser.cxx
+++ b/src/Fl_File_Chooser.cxx
@@ -197,9 +197,18 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char
o->callback((Fl_Callback*)cb_);
{ fileList = new Fl_File_Browser(10, 45, 295, 225);
fileList->type(2);
+ fileList->box(FL_DOWN_BOX);
fileList->callback((Fl_Callback*)cb_fileList);
fileList->window()->hotspot(fileList);
} // Fl_File_Browser* fileList
+ { errorBox = new Fl_Box(10, 45, 295, 225, "dynamic error display");
+ errorBox->box(FL_DOWN_BOX);
+ errorBox->color(FL_BACKGROUND2_COLOR);
+ errorBox->labelsize(18);
+ errorBox->labelcolor((Fl_Color)1);
+ errorBox->align(Fl_Align(133|FL_ALIGN_INSIDE));
+ errorBox->hide();
+ } // Fl_Box* errorBox
{ previewBox = new Fl_Box(305, 45, 175, 225, "?");
previewBox->box(FL_DOWN_BOX);
previewBox->labelsize(100);
@@ -471,3 +480,17 @@ Fl_Widget* Fl_File_Chooser::add_extra(Fl_Widget* gr) {
}
return ret;
}
+
+/**
+ Show error box if val=1, hide if val=0
+*/
+void Fl_File_Chooser::show_error_box(int val) {
+ if ( val ) {
+ errorBox->color(fileList->color()); // inherit fileList's bg color
+ errorBox->show();
+ fileList->hide();
+ } else {
+ errorBox->hide();
+ fileList->show();
+ }
+}