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. Creating views in Top Level MDI

Creating views in Top Level MDI

Scheduled Pinned Locked Moved C / C++ / MFC
questiongame-dev
5 Posts 2 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.
  • S Offline
    S Offline
    snir_ya
    wrote on last edited by
    #1

    Hi, I have a Top Level MDI windows application. From the main frame users can choose a game. The game should open in a new frame window. This frame window should have a different view each time - according the game the user has selected. How do i intervene with the creation of the views of the frame windows? I have only one MainFrm class and one CView-derived class, which is enough. All i have to do is tell the view to draw a different backgournd each time (according to the selected game). Thanks a lot in advance guys. Snir_ya.

    N 1 Reply Last reply
    0
    • S snir_ya

      Hi, I have a Top Level MDI windows application. From the main frame users can choose a game. The game should open in a new frame window. This frame window should have a different view each time - according the game the user has selected. How do i intervene with the creation of the views of the frame windows? I have only one MainFrm class and one CView-derived class, which is enough. All i have to do is tell the view to draw a different backgournd each time (according to the selected game). Thanks a lot in advance guys. Snir_ya.

      N Offline
      N Offline
      Nishad S
      wrote on last edited by
      #2

      The selection can be saved in the doc class object, right?

      - NS - [ODBaseBtn]

      S 1 Reply Last reply
      0
      • N Nishad S

        The selection can be saved in the doc class object, right?

        - NS - [ODBaseBtn]

        S Offline
        S Offline
        snir_ya
        wrote on last edited by
        #3

        yes it can. Then?

        N 1 Reply Last reply
        0
        • S snir_ya

          yes it can. Then?

          N Offline
          N Offline
          Nishad S
          wrote on last edited by
          #4

          So in the view class you can use that. I mean, (but I am not sure, since I dont know your implementation), you can handle it in the OnDraw, or in your drawing code. Like...void CTopLevelMDI_TestView::OnDraw(CDC* /*pDC*/) { CTopLevelMDI_TestDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; if( pDoc->m_nGameType == 1 ) { // Drawing for Game 1 } else if( ... ) { // So on... } }

          - NS - [ODBaseBtn]

          S 1 Reply Last reply
          0
          • N Nishad S

            So in the view class you can use that. I mean, (but I am not sure, since I dont know your implementation), you can handle it in the OnDraw, or in your drawing code. Like...void CTopLevelMDI_TestView::OnDraw(CDC* /*pDC*/) { CTopLevelMDI_TestDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; if( pDoc->m_nGameType == 1 ) { // Drawing for Game 1 } else if( ... ) { // So on... } }

            - NS - [ODBaseBtn]

            S Offline
            S Offline
            snir_ya
            wrote on last edited by
            #5

            Excellent. Using the the document as the bearer of the game type solves the problem. Thakns a lot. Snir_ya.

            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