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. Change from fixed client window to scrolling client window

Change from fixed client window to scrolling client window

Scheduled Pinned Locked Moved C / C++ / MFC
c++graphicsworkspace
4 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.
  • K Offline
    K Offline
    Kwanalouie
    wrote on last edited by
    #1

    Using Visual C++ 6.0 MFC in SDI application. I setup an application using fixed client windows. Now I see that I need to add scrolling to the client windows for my drawing. I don't understand what and where exactly needs to change now. Thanks

    N 1 Reply Last reply
    0
    • K Kwanalouie

      Using Visual C++ 6.0 MFC in SDI application. I setup an application using fixed client windows. Now I see that I need to add scrolling to the client windows for my drawing. I don't understand what and where exactly needs to change now. Thanks

      N Offline
      N Offline
      Nelek
      wrote on last edited by
      #2

      One possibility (the more obvious) is to add a ScrollBar to your view and the implement all the other things by yourself. Other possibility is to have two different views attached (although it is SDI) to your application, one "normal" view, as you have and another one derived from CScrollView, it will already have almost all the functionality that you need for your scrolling implemented. And another one, is to choose the CScrollView as parent of your main view from the beggining when you create your application and then change the size of the view dinamically according to your needs. If the size of the view is smaller than your window, the scroll will automatically disabled.

      Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson Rating helpfull answers is nice, but saying thanks can be even nicer.

      K 1 Reply Last reply
      0
      • N Nelek

        One possibility (the more obvious) is to add a ScrollBar to your view and the implement all the other things by yourself. Other possibility is to have two different views attached (although it is SDI) to your application, one "normal" view, as you have and another one derived from CScrollView, it will already have almost all the functionality that you need for your scrolling implemented. And another one, is to choose the CScrollView as parent of your main view from the beggining when you create your application and then change the size of the view dinamically according to your needs. If the size of the view is smaller than your window, the scroll will automatically disabled.

        Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson Rating helpfull answers is nice, but saying thanks can be even nicer.

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

        I tried changing things but there is one area of the code that I don't understand. I have two views that I switch between. void CMainFrame::CreateActivateView(CRuntimeClass *pNewViewClass, UINT nID) { CView* pOldView = GetActiveView(); CView* pNewView = NULL; // plus code to switch between views. } But when I try to Change the class to CScrolView I cannot compile the line CScrollView* pOldView = GetActiveView(); But I don't understand how to change that from CView* to CScrollView* Thanks

        N 1 Reply Last reply
        0
        • K Kwanalouie

          I tried changing things but there is one area of the code that I don't understand. I have two views that I switch between. void CMainFrame::CreateActivateView(CRuntimeClass *pNewViewClass, UINT nID) { CView* pOldView = GetActiveView(); CView* pNewView = NULL; // plus code to switch between views. } But when I try to Change the class to CScrolView I cannot compile the line CScrollView* pOldView = GetActiveView(); But I don't understand how to change that from CView* to CScrollView* Thanks

          N Offline
          N Offline
          Nelek
          wrote on last edited by
          #4

          Try casting: CScrollView* pOldView = (CScrollView*) GetActiveView (); Hope it helps

          Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson Rating helpfull answers is nice, but saying thanks can be even nicer.

          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