[fltk.general] fl_native_file_chooser utility

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

fl_native_file_chooser utility "anmol.... 05:39 Sep 27 top right image
  This would be a useful addition to fltk.

char *fl_native_file_chooser(const char *message,const char *pat,const char *fname,int relative=0) {

    static char   retname[FL_PATH_MAX];           // Returned filename

    char *tmpstr = NULL;

    

    Fl_Native_File_Chooser *fnfc = new Fl_Native_File_Chooser;

    fnfc->title(message);

    fnfc->type(Fl_Native_File_Chooser::BROWSE_FILE);

    fnfc->filter(pat);

    if (!fname || !*fname) fname = ".";

   fnfc->preset_file(fname);

    // Show native chooser

    switch ( fnfc->show() ) {

        case -1: 

            break;  // ERROR

        case  1: 

            break;  // CANCEL

        default: 

            tmpstr = (char *)fnfc->filename();

            break;  // FILE CHOSEN

    }

    

    if (tmpstr && relative) {

        fl_filename_relative(retname, sizeof(retname), (char *)fnfc->filename());

        return retname;

    }

    return tmpstr;

}

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/3e58c209-eb9b-4459-8d63-d0e7a26f3246n%40googlegroups.com.
Direct Link to Message ]
 
bottom left image   bottom right image
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2022 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.