Hi
I'd like to give a user the opportunity to store workspace in both, registry and file system.
Therfore I derieved my own CFileDialog and added a selection for the two storage locations.
The problem I have now is how to show the registry content. I tried to create a new CListCtrl and place it where the original one of CFileDialog is. I tried to show/hide this new list according to the user selection. But it doesn't work! When I do a ShowWindow(SW_HIDE) of the original list control (lst1), only it's content gets hidden. And additionally I don't get my new list control to be shown.
I create and place the new list as follows in OnInitDone():
Maybe I need to create the list with another parent? I already tried lst1->GetParent() and lst1 itself (actually CWnd* to lst1).Code:CRect rc; CWnd* pChildWnd = NULL; CWnd* pParentWnd = NULL; pParentWnd = GetParent(); ASSERT(NULL != pParentWnd); pChildWnd = pParentWnd->GetDlgItem(lst1); // File list of the common file dialog. We need // the coordinates for our registry list ctrl ASSERT(NULL != pChildWnd); pChildWnd->GetWindowRect(&rc); // For now, don't set the VISIBLE flag --> we first need to check whether registry is chosen m_ctlLCWspList.Create( WS_CHILD | /*WS_VISIBLE |*/ WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_HSCROLL | LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_EDITLABELS, rc, this, WM_USER ); DWORD dwStyle = m_ctlLCWspList.GetStyle(); m_ctlLCWspList.ModifyStyleEx(0, WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_CLIENTEDGE | LVS_EX_INFOTIP | LVS_EX_UNDERLINEHOT | LVS_EX_UNDERLINECOLD); m_ctlLCWspList.SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
For changing which list to display I do the following when I got a change notification:
Maybe this is all wrong I try here and there is a simple way to cope with lst1 only? If yes, how (e.g. fill registry content and when required fill file system content again in an easy way)?Code:CWnd* pParentWnd = NULL; CWnd* pChildWnd1 = NULL; CWnd* pChildWnd2 = NULL; pParentWnd = GetParent(); ASSERT(NULL != pParentWnd); pChildWnd1 = pParentWnd->GetDlgItem(cmb2); ASSERT(NULL != pChildWnd1); pChildWnd2 = pParentWnd->GetDlgItem(lst1); ASSERT(NULL != pChildWnd2); if (m_bStoreToRegistry) { // Registry: diable file related controls pChildWnd1->EnableWindow(FALSE); m_ctlLCWspList.ShowWindow(SW_SHOW); pChildWnd2->ShowWindow(SW_HIDE); } // if (m_bStoreToRegistry) else { // File system: enable file related controls pChildWnd1->EnableWindow(TRUE); m_ctlLCWspList.ShowWindow(SW_HIDE); pChildWnd2->ShowWindow(SW_SHOW); } // else
Many thanks for any help!
Holi
P.S.: Another related thread of me is http://www.codeguru.com/forum/showth...702#post927702 (actually quite the same).




Reply With Quote