0

I am trying to use the Fl_Native_File_Chooser from fltk 1.3 and the class works fine except for setting the start directory.

    const char *start_dir = "C:\\Program Files (x86)";
    Fl_Native_File_Chooser native(Fl_Native_File_Chooser::BROWSE_DIRECTORY);
    native.directory( start_dir );
    native.title( "Select a directory");

    native.type(Fl_Native_File_Chooser::BROWSE_DIRECTORY);

    std::string directoryName;
    switch ( native.show() ) 
    {
    case -1: break; //fprintf(stderr, "ERROR: %s\n", native.errmsg()); break; // ERROR
    case  1: break; //fprintf(stderr, "*** CANCEL\n"); fl_beep(); break;    // CANCEL
    default:                            // PICKED FILE
        if ( native.filename() ) directoryName = native.filename();
        break;
    }
    std::cout << directoryName << std::endl;

I've looked into the code. In Fl_Native_File_Chooser_WIN32.cxx and int Fl_Native_File_Chooser::showdir() I don't understand why the _binf.pidlRoot is not set. I have looked at Fl_Native_File_Chooser::showfile() but the way the dialoge is setup is different.

So has anyone successfully set the startup directory for the Fl_Native_File_Chooser when you are browsing for a directory?

The strange thing to me is that the normal Fl_File_Chooser works.

DannyK
  • 1,342
  • 16
  • 23

1 Answers1

0

Your code works for me, although I'm not sure what you mean by "_binf.pidlRoot". What do you expect the code to do, and what does it actually do? Is there any code before or after the part that you posted? This could affect things...