|
Hi, this is my first post.
Work flow is like this:
i open child dialog from a dialog( which is launched from a toolbar of a window) after editing i close the child dialog, after closing child dialog shadow is retained on window but not on the parent dialog. Later when i close the parent dialog the child dialog shadow disappears.
(issue exist only when i edit in child dialog)
Thanks a lot,
Shivaraj
|
|
|
|
|
That's because your main window does not receive a WM_PAINT message until the main dialog terminates. Cascading dialogs in this way is not the best design pattern.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi, I tried to use GetAncestor() method to get main window handle & REPAINT with RedrawWindow() or UpdateWindow(). Neither of which is working.
|
|
|
|
|
That's because, as I said before, your main window will not be able to action a WM_PAINT , or any other, message, until the dialog returns from DoModal() . You need to consider whether your design is the right way of doing things.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Thanks for reply, I have seen same design patterns(using child dialog)in the same application but there is no issue there. I compared the code, am not finding any difference in RePainting aspects.
here i have sample code..
Below used OnModifyview dialog is child dialog of a dialog.
void CSelectColumnViewDlg::OnModifyview()
{
int iIndex = m_ctrlColumnViewList.GetCurSel();
if (iIndex < 0)
return;
double dViewId = m_ctrlColumnViewList.GetItemDataDouble(iIndex);
if (dViewId == 0.0)
return;
CWaitCursor wait;
CComPtr<idispatch> pDispColumnView;
CComPtr<itrackingdatamanager> pManager;
pManager.CoCreateInstance(CLSID_TrackingDataManager);
if (pManager)
pManager->GetColumnView(dViewId, &pDispColumnView);
CComQIPtr<itrackingcolumnview> pColumnView(pDispColumnView);
if (pColumnView == NULL)
return;
CModifyColumnViewDlg dlg;
dlg.SetColumnView(pColumnView);
dlg.SetType(m_lSolution, m_lListType);
dlg.SetTrackGroupCd(m_dTrackGroupCd);
std::set<cstring>* pExistingNames = GetExistingNames(iIndex);
dlg.SetExistingNames(pExistingNames);
if (dlg.DoModal() == IDOK)
{
HWND hWndAncestor = ::GetAncestor(GetSafeHwnd(), GA_ROOT);
m_ctrlColumnViewList.DeleteString(iIndex);
CComBSTR bstrName;
pColumnView->get_Name(&bstrName);
int iIndex = m_ctrlColumnViewList.AddString(CString(bstrName));
m_ctrlColumnViewList.SetItemDataDouble(iIndex, dViewId);
m_ctrlColumnViewList.SetCurSel(iIndex);
}
if (pExistingNames)
delete pExistingNames;
Invalidate();
//OnPaint(); //not working
//RedrawWindow();// not working
}
modified 7-Oct-12 0:04am.
|
|
|
|
|
I don't know what more I can say except to repeat my earlier comment: as long as you have a dialog open (called via DoModal() ) the main window cannot respond to messages and thus will not repaint itself.
One of these days I'm going to think of a really clever signature.
|
|
|
|