-
October 9th, 2013, 08:01 AM
#1
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
-
October 11th, 2013, 02:17 AM
#2
Re: Wm_vscroll
Originally Posted by doxdici
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
-
October 11th, 2013, 06:53 AM
#3
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.
- ...
-
October 11th, 2013, 10:26 AM
#4
Re: Wm_vscroll
First, note to avoid further confusion: there are two types of scrollbars in Windows.
- Scrollbars for windows having WS_HSCROLL and/or WS_VSCROLL styles.
- Scrollbar common controls (of window class "ScrollBar") which are encapsulated by CScrollBar MFC class.
Originally Posted by doxdici
[...]
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|