From 0693c70f577624e66fd660a888f2d2bcd3fc180b Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Fri, 10 Jul 2020 21:49:00 -0700 Subject: 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() --- src/Fl_File_Chooser.cxx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/Fl_File_Chooser.cxx') 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(); + } +} -- cgit v1.2.3