1. wxDirDialog documentation errors
- Posted by jmduro Dec 06, 2015
- 1113 views
I was not able to provide a default directory to wxDirDialog until I understood the documentation was wrong. It writes:
Creation Parameters atom parent sequence message [= "Choose a directory"] integer style [= 0] integer x [= -1] integer y [= -1] integer cx [= -1] integer cy [= -1] sequence defaultPath [= ""]
It should have been written this way:
Creation Parameters atom parent sequence message [= "Choose a directory"] sequence defaultPath [= ""] integer style [= 0]
Following lines have to be added to wxeud.e:
wxDD_CHANGE_DIR = 0x0100, wxDD_DEFAULT_STYLE = (wxDEFAULT_DIALOG_STYLE+wxRESIZE_BORDER), wxDD_DIR_MUST_EXIST = 0x0200,
Here is an example of usage:
DirDialog = create( wxDirDialog, {win, "Select folder", "c:\\temp", wxDD_DEFAULT_STYLE + wxDD_DIR_MUST_EXIST}) -- get the folder name if show_modal( DirDialog ) then folderName = get_dir_path( DirDialog ) else set_status_text(sb, "No Folder Selected", 2) abort(1) end if
Jean-Marc