Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Get Current View in SDI

Get Current View in SDI

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    D Manivelan
    wrote on last edited by
    #1

    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.

    L 1 Reply Last reply
    0
    • D D Manivelan

      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.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Since SDI stands for Single Document Interface there is only one document and one view, so it is always the active one.

      speaking as ...

      K 1 Reply Last reply
      0
      • L Lost User

        Since SDI stands for Single Document Interface there is only one document and one view, so it is always the active one.

        speaking as ...

        K Offline
        K Offline
        krmed
        wrote on last edited by
        #3

        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

        L 1 Reply Last reply
        0
        • K krmed

          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

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Fine, but you should be replying to the OP's message, not to mine.

          speaking as ...

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups