Added callback to start in current directory
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3630 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b661e6759e
commit
bfa2e032ef
@ -46,6 +46,34 @@
|
|||||||
IMPLEMENT_CLASS(wxDirDialog, wxDialog)
|
IMPLEMENT_CLASS(wxDirDialog, wxDialog)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int CALLBACK
|
||||||
|
BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData)
|
||||||
|
{
|
||||||
|
TCHAR szDir[MAX_PATH];
|
||||||
|
|
||||||
|
switch(uMsg)
|
||||||
|
{
|
||||||
|
case BFFM_INITIALIZED:
|
||||||
|
// We have put m_path into pData.
|
||||||
|
// TRUE -> passing char *, not dir id.
|
||||||
|
SendMessage(hwnd,BFFM_SETSELECTION,TRUE,pData);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BFFM_SELCHANGED:
|
||||||
|
// Set the status window to the currently selected path.
|
||||||
|
if (SHGetPathFromIDList((LPITEMIDLIST) lp ,szDir))
|
||||||
|
{
|
||||||
|
SendMessage(hwnd,BFFM_SETSTATUSTEXT,0,(LPARAM)szDir);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
|
wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
|
||||||
// const wxString& caption,
|
// const wxString& caption,
|
||||||
const wxString& defaultPath,
|
const wxString& defaultPath,
|
||||||
@ -99,8 +127,8 @@ int wxDirDialog::ShowModal(void)
|
|||||||
bi.pszDisplayName = lpBuffer;
|
bi.pszDisplayName = lpBuffer;
|
||||||
bi.lpszTitle = m_message; // BC++ 4.52 says LPSTR, not LPTSTR?
|
bi.lpszTitle = m_message; // BC++ 4.52 says LPSTR, not LPTSTR?
|
||||||
bi.ulFlags = 0;
|
bi.ulFlags = 0;
|
||||||
bi.lpfn = NULL;
|
bi.lpfn = BrowseCallbackProc;
|
||||||
bi.lParam = 0;
|
bi.lParam = (LPARAM)m_path.c_str();
|
||||||
|
|
||||||
// Browse for a folder and return its PIDL.
|
// Browse for a folder and return its PIDL.
|
||||||
pidlBrowse = SHBrowseForFolder(&bi);
|
pidlBrowse = SHBrowseForFolder(&bi);
|
||||||
|
Loading…
Reference in New Issue
Block a user