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. Scroll bars

Scroll bars

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
2 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.
  • N Offline
    N Offline
    Nick Armstrong
    wrote on last edited by
    #1

    I have created a window inherited from CFrameWnd using the create function and I use WS_VSCROLL to stick a vertical scroll bar on the right edge. I want to be able to code the movements of the user clicking on the scroll bar etc and the movement shown withing the bar, my problem is what is the scrollbar called so I can call member functions such as GetScrollPos() etc. I have tried the method OnVScroll and used the pScrollBar parameter but this only comes up with a run time error as if it were null which I think it is. cheers in advance Nick

    O 1 Reply Last reply
    0
    • N Nick Armstrong

      I have created a window inherited from CFrameWnd using the create function and I use WS_VSCROLL to stick a vertical scroll bar on the right edge. I want to be able to code the movements of the user clicking on the scroll bar etc and the movement shown withing the bar, my problem is what is the scrollbar called so I can call member functions such as GetScrollPos() etc. I have tried the method OnVScroll and used the pScrollBar parameter but this only comes up with a run time error as if it were null which I think it is. cheers in advance Nick

      O Offline
      O Offline
      Oliver Anhuth
      wrote on last edited by
      #2

      The pScrollBar is null if the scrollbar is not a control but belongs to a window. Simply use the CWnd::GetScrollPos member function.

      void CMainFrame::SomeFunc()
      {
      ...
      int pos = GetScrollPos(SB_VERT);
      ...
      }

      Oliver

      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