Get Current View in SDI
-
I am developing a application in MDI which contains few child windows. And also i want few windows which is not attached to CMainframe.So i created new class derived from CFrameWnd.
pTagSummaryTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CHarmonyDoc),
RUNTIME_CLASS(CFrameWnd), // main SDI frame window
RUNTIME_CLASS(CTagSummary));
AddDocTemplate(pTagSummaryTemplate);And also each window has to updated frequently and im doing this by uisng below code for MDI childwindows from CMainframe
CMDIChildWnd *fChWnd = GetActivePanelWnd();
if(fChWnd->GetSafeHwnd())
{
CView *curView = ((CView *)fChWnd->GetActiveView());
if(curView)
{
((COverView *)curView)->UpdatePanel();
}
}**But for SDI, i dont know how to get activeview(Current active view of SDI)**So pls help me.
-
I am developing a application in MDI which contains few child windows. And also i want few windows which is not attached to CMainframe.So i created new class derived from CFrameWnd.
pTagSummaryTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CHarmonyDoc),
RUNTIME_CLASS(CFrameWnd), // main SDI frame window
RUNTIME_CLASS(CTagSummary));
AddDocTemplate(pTagSummaryTemplate);And also each window has to updated frequently and im doing this by uisng below code for MDI childwindows from CMainframe
CMDIChildWnd *fChWnd = GetActivePanelWnd();
if(fChWnd->GetSafeHwnd())
{
CView *curView = ((CView *)fChWnd->GetActiveView());
if(curView)
{
((COverView *)curView)->UpdatePanel();
}
}**But for SDI, i dont know how to get activeview(Current active view of SDI)**So pls help me.
Since SDI stands for Single Document Interface there is only one document and one view, so it is always the active one.
-
Since SDI stands for Single Document Interface there is only one document and one view, so it is always the active one.
Actually, in an SDI, there is only one document, but there can be many views. In any event (to the OP) the proper way to update views in SDI or MDI is to store and update your data in the document, then call the document's UpdateAllViews method, passing a hint if needed. This automatically calls the OnUpdate method of every view without you having to call it manually. In that method, you can do whatever is necessary to update the view. Hope this helps.
Karl - WK5M PP-ASEL-IA (N43CS) PGP Key: 0xDB02E193 PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
-
Actually, in an SDI, there is only one document, but there can be many views. In any event (to the OP) the proper way to update views in SDI or MDI is to store and update your data in the document, then call the document's UpdateAllViews method, passing a hint if needed. This automatically calls the OnUpdate method of every view without you having to call it manually. In that method, you can do whatever is necessary to update the view. Hope this helps.
Karl - WK5M PP-ASEL-IA (N43CS) PGP Key: 0xDB02E193 PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
Fine, but you should be replying to the OP's message, not to mine.