Wm_vscroll
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Wm_vscroll

  1. #1
    Join Date
    Oct 2004
    Posts
    265

    Wm_vscroll

    Hi,
    I have a class derived from CStatic.
    Also two ScrollBar,
    CScrollBar m_HScroll;
    CScrollBar m_VScroll;

    created equals

    m_HScroll.Create(SBS_HORZ | SBS_BOTTOMALIGN |WS_CHILD , rect, father, 1100);
    m_HScroll.EnableScrollBarCtrl(SB_HORZ );

    m_VScroll.Create(SBS_VERT | SBS_RIGHTALIGN |WS_CHILD, rect, father, 1200);
    m_VScroll.EnableScrollBarCtrl(SB_VERT );

    int the message map
    BEGIN_MESSAGE_MAP(CDrawBitmap, CStatic)
    ON_WM_VSCROLL()
    ON_WM_HSCROLL()

    END_MESSAGE_MAP()

    ...the problem is that the window doesn't receive the message relative to the vscroll, only relative to the hscroll.
    I don't understand what is wrong with the vertical scrollbar...

    Thank you a lot

  2. #2
    Join Date
    Oct 2004
    Posts
    265

    Re: Wm_vscroll

    Quote Originally Posted by doxdici View Post
    Hi,
    I have a class derived from CStatic.
    Also two ScrollBar,
    CScrollBar m_HScroll;
    CScrollBar m_VScroll;

    created equals

    m_HScroll.Create(SBS_HORZ | SBS_BOTTOMALIGN |WS_CHILD , rect, father, 1100);
    m_HScroll.EnableScrollBarCtrl(SB_HORZ );

    m_VScroll.Create(SBS_VERT | SBS_RIGHTALIGN |WS_CHILD, rect, father, 1200);
    m_VScroll.EnableScrollBarCtrl(SB_VERT );

    int the message map
    BEGIN_MESSAGE_MAP(CDrawBitmap, CStatic)
    ON_WM_VSCROLL()
    ON_WM_HSCROLL()

    END_MESSAGE_MAP()

    ...the problem is that the window doesn't receive the message relative to the vscroll, only relative to the hscroll.
    I don't understand what is wrong with the vertical scrollbar...

    Thank you a lot
    So,
    I created a MyScrollBar class that inherited from CScrollBar, and in this case the WM_SCROLL message has been received from MyScrollBar class, but I don't understand why nPos of the OnVScroll event is always 0.
    Could please someone help me?
    Thanks a lot...
    Isabella

  3. #3
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    3,976

    Re: Wm_vscroll

    could be many things...
    - are you sure the create suceeds ?
    - the create doesn't have WS_VISIBLE, so the scrollbar isn't visible ?
    - you've not set a vertical scroll range, or the vertical scroll range is less than the height of the window.
    - ...

  4. #4
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,051

    Re: Wm_vscroll

    First, note to avoid further confusion: there are two types of scrollbars in Windows.

    1. Scrollbars for windows having WS_HSCROLL and/or WS_VSCROLL styles.
    2. Scrollbar common controls (of window class "ScrollBar") which are encapsulated by CScrollBar MFC class.


    Quote Originally Posted by doxdici View Post
    [...]
    Code:
        m_HScroll.Create(SBS_HORZ | SBS_BOTTOMALIGN |WS_CHILD , rect, father, 1100);
        m_HScroll.EnableScrollBarCtrl(SB_HORZ );
    [...]
    Here, you have a scrollbar control, then called EnableScrollBarCtrl for that control.
    In other words, you are trying to enable a scrollbar for a scrollbar control, which is nonsense.
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center