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. How can I know if scrollbar appears ?

How can I know if scrollbar appears ?

Scheduled Pinned Locked Moved C / C++ / MFC
questiondebugging
10 Posts 4 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.
  • M Offline
    M Offline
    mesajflaviu
    wrote on last edited by
    #1

    Hello . I have an MDI application with CView based on CScrollView and somewhere , in OnMouseMove handler I have :

    if(pView->GetStyle() & WS\_HSCROLL)TRACE("\\n WS\_HSCROLL \\n");
    if(pView->GetStyle() & WS\_VSCROLL)TRACE("\\n WS\_VSCROLL \\n");
    

    without any effect ... either scrollbar appear or not , I haven't anything ... how can I know for sure of scrollbar appear or not ? Thanks !

    C C 2 Replies Last reply
    0
    • M mesajflaviu

      Hello . I have an MDI application with CView based on CScrollView and somewhere , in OnMouseMove handler I have :

      if(pView->GetStyle() & WS\_HSCROLL)TRACE("\\n WS\_HSCROLL \\n");
      if(pView->GetStyle() & WS\_VSCROLL)TRACE("\\n WS\_VSCROLL \\n");
      

      without any effect ... either scrollbar appear or not , I haven't anything ... how can I know for sure of scrollbar appear or not ? Thanks !

      C Offline
      C Offline
      Chris Meech
      wrote on last edited by
      #2

      Have you called SetScrollSizes()[^] in your OnInitialUpdate() method?

      Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

      M 1 Reply Last reply
      0
      • M mesajflaviu

        Hello . I have an MDI application with CView based on CScrollView and somewhere , in OnMouseMove handler I have :

        if(pView->GetStyle() & WS\_HSCROLL)TRACE("\\n WS\_HSCROLL \\n");
        if(pView->GetStyle() & WS\_VSCROLL)TRACE("\\n WS\_VSCROLL \\n");
        

        without any effect ... either scrollbar appear or not , I haven't anything ... how can I know for sure of scrollbar appear or not ? Thanks !

        C Offline
        C Offline
        Code o mat
        wrote on last edited by
        #3

        Can GetScrollBarInfo[^] give you the required information?

        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world. Fry: But this is HDTV. It's got better resolution than the real world <

        M 1 Reply Last reply
        0
        • C Chris Meech

          Have you called SetScrollSizes()[^] in your OnInitialUpdate() method?

          Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

          M Offline
          M Offline
          mesajflaviu
          wrote on last edited by
          #4

          Yes , everything it's allright there ... sometime scrollbar appear , sometime not ... I mean , if the window is reduced , scrollbar appear , if window is increased , scrollbar dissapear .

          L 1 Reply Last reply
          0
          • C Code o mat

            Can GetScrollBarInfo[^] give you the required information?

            > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world. Fry: But this is HDTV. It's got better resolution than the real world <

            M Offline
            M Offline
            mesajflaviu
            wrote on last edited by
            #5

            I didn't use GetScrollBarInfo by now ... I don't know how ... I will try and let you know if I did it .

            C 1 Reply Last reply
            0
            • M mesajflaviu

              I didn't use GetScrollBarInfo by now ... I don't know how ... I will try and let you know if I did it .

              C Offline
              C Offline
              Code o mat
              wrote on last edited by
              #6

              All right, good luck, if you get stuck somewhere, tell me/us and we'll see if i/we can help.

              > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world. Fry: But this is HDTV. It's got better resolution than the real world <

              M 1 Reply Last reply
              0
              • M mesajflaviu

                Yes , everything it's allright there ... sometime scrollbar appear , sometime not ... I mean , if the window is reduced , scrollbar appear , if window is increased , scrollbar dissapear .

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

                That sounds like correct behaviour. The scrollbar should only appear when the amount of data to display is larger than the client area of the window, either horizontally, vertically, or both. Are you sure that you are recalculating your scroll sizes correctly when the window size changes?

                Just say 'NO' to evaluated arguments for diadic functions! Ash

                M 1 Reply Last reply
                0
                • L Lost User

                  That sounds like correct behaviour. The scrollbar should only appear when the amount of data to display is larger than the client area of the window, either horizontally, vertically, or both. Are you sure that you are recalculating your scroll sizes correctly when the window size changes?

                  Just say 'NO' to evaluated arguments for diadic functions! Ash

                  M Offline
                  M Offline
                  mesajflaviu
                  wrote on last edited by
                  #8

                  Yes , I'm sure . Still , I can't solve the problem ... I see that VC2005 have CheckScrollBars(...) method , but I work in VC6 ... :doh:

                  1 Reply Last reply
                  0
                  • C Code o mat

                    All right, good luck, if you get stuck somewhere, tell me/us and we'll see if i/we can help.

                    > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world. Fry: But this is HDTV. It's got better resolution than the real world <

                    M Offline
                    M Offline
                    mesajflaviu
                    wrote on last edited by
                    #9

                    I solve the problem in that way : I write myself CheckScrollBars(...) method :

                    void CMyView::CheckScrollBars(BOOL& bHasHorzBar, BOOL& bHasVertBar) const
                    {
                    DWORD dwStyle = GetStyle();

                    CScrollBar\* pBar = GetScrollBarCtrl(SB\_VERT);
                    bHasVertBar = ((pBar != NULL) && pBar->IsWindowEnabled()) || (dwStyle & WS\_VSCROLL);
                    
                    pBar = GetScrollBarCtrl(SB\_HORZ);
                    bHasHorzBar = ((pBar != NULL) && pBar->IsWindowEnabled()) || (dwStyle & WS\_HSCROLL);
                    

                    }

                    C 1 Reply Last reply
                    0
                    • M mesajflaviu

                      I solve the problem in that way : I write myself CheckScrollBars(...) method :

                      void CMyView::CheckScrollBars(BOOL& bHasHorzBar, BOOL& bHasVertBar) const
                      {
                      DWORD dwStyle = GetStyle();

                      CScrollBar\* pBar = GetScrollBarCtrl(SB\_VERT);
                      bHasVertBar = ((pBar != NULL) && pBar->IsWindowEnabled()) || (dwStyle & WS\_VSCROLL);
                      
                      pBar = GetScrollBarCtrl(SB\_HORZ);
                      bHasHorzBar = ((pBar != NULL) && pBar->IsWindowEnabled()) || (dwStyle & WS\_HSCROLL);
                      

                      }

                      C Offline
                      C Offline
                      Code o mat
                      wrote on last edited by
                      #10

                      If it works for you, then :thumbsup:, thanks for sharing your solution. :)

                      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world. Fry: But this is HDTV. It's got better resolution than the real world <

                      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