Closed cschol closed 3 years ago
osdialog should not hold a state or tell Windows to hold a state for the last used directory. It should be the responsibility of the caller of osdialog_file
to give the last selected directory as an argument to that function.
I am not sure I understand. path
is passed in by the caller. The callback sends a message to update the window to the passed in path. That's the way that dialog box works, at least on Windows.
EDIT: My initial description of the issue is misleading. The Dialog should not remember the last location, but it should show the location passed in, which it currently does not. Updated.
+1 for this! Hope in a merge sono, thanks.
On Windows, the directory selection dialog does not
remembershow the directory passed in. This PR fixes the issue.The general approach to the solution is described here.
Microsoft documentation for
SHBrowseForFolderW
states: "If you implement a callback function, specified in the lpfn member of the BROWSEINFO structure, you receive a handle to the dialog box. One use of this window handle is to modify the layout or contents of the dialog box. Because it is not resizable, modifying the older style dialog box is relatively straightforward. Modifying the newer style dialog box is much more difficult, and not recommended. Not only does it have a different size and layout than the old style, but its dimensions and the positions of its controls change every time it is resized by the user."Why is this important? The current implementation uses the new style dialog box. The issue with the callback solution is that the current directory is not "focused" in the directory box when using the new style box. The user still has to scroll to get to the currently selected directory to change it. The old style dialog box focuses correctly and the user can very quickly select a new directory at the same level. Therefore, the dialog box style was changed to old style box for this solution.