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.fl | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'src/Fl_File_Chooser.fl') diff --git a/src/Fl_File_Chooser.fl b/src/Fl_File_Chooser.fl index d222bd1c8..7cf01e1c7 100644 --- a/src/Fl_File_Chooser.fl +++ b/src/Fl_File_Chooser.fl @@ -66,7 +66,8 @@ class FL_EXPORT Fl_File_Chooser {open } decl {void update_preview();} {private local } - Function {Fl_File_Chooser(const char *d, const char *p, int t, const char *title)} {} { + Function {Fl_File_Chooser(const char *d, const char *p, int t, const char *title)} {open + } { code {if (!prefs_) { prefs_ = new Fl_Preferences(Fl_Preferences::CORE_USER, "fltk.org", "filechooser"); }} {} @@ -77,11 +78,11 @@ class FL_EXPORT Fl_File_Chooser {open fileList->deselect(); Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this); window->hide();} open - private xywh {507 327 490 380} type Double hide resizable + private xywh {1171 438 490 380} type Double resizable code0 {if (title) window->label(title);} code1 {\#include } code2 {\#include } - code3 {\#include } modal + code3 {\#include } modal visible } { Fl_Group {} {open private xywh {10 10 470 25} @@ -106,14 +107,18 @@ window->hide();} open } } Fl_Tile {} { - callback {update_preview();} + callback {update_preview();} open private xywh {10 45 470 225} resizable } { Fl_File_Browser fileList { callback {fileListCB();} - private xywh {10 45 295 225} type Hold hotspot + private xywh {10 45 295 225} type Hold box DOWN_BOX hotspot code0 {\#include } } + Fl_Box errorBox { + label {dynamic error display} selected + private xywh {10 45 295 225} box DOWN_BOX color 7 labelsize 18 labelcolor 1 align 149 hide + } Fl_Box previewBox { label {?} private xywh {305 45 175 225} box DOWN_BOX labelsize 100 align 80 @@ -349,7 +354,7 @@ okButton->parent()->init_sizes();} {} } { code {fileList->textfont(f);} {} } - Function {textfont()} {selected return_type Fl_Font + Function {textfont()} {return_type Fl_Font } { code {return (fileList->textfont());} {} } @@ -475,6 +480,18 @@ window->resizable(svres);} {} } code {return ret;} {} } + Function {show_error_box(int val)} { + comment {Show error box if val=1, hide if val=0} open protected return_type void + } { + code {if ( val ) { + errorBox->color(fileList->color()); // inherit fileList's bg color + errorBox->show(); + fileList->hide(); +} else { + errorBox->hide(); + fileList->show(); +}} {} + } } decl {FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);} {public local -- cgit v1.2.3