Ok, i've finally succeed: using «chdir()» is the answer.
For getting it to work, you have to get absolute file path, with 
«fl_filename_absolute()».

Here's what i did:

void BrowserCallback(Fl_Widget *w, void *data)
{
  Fl_File_Browser *fileb = (Fl_File_Browser *) w;
  int selected_file = fileb->value();
  const char *path = fileb->text(selected_file);
  char absolute_path[2048];
  fl_filename_absolute (absolute_path, sizeof(absolute_path), path);

  fprintf(stderr,"well, i'm here: %s\n",absolute_path);

  if (fl_filename_isdir (absolute_path) ) {
    fprintf(stderr,"will go to: %s\n",absolute_path);
    chdir (absolute_path);
    fileb->load(absolute_path);
  }
}


_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to