Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I use the function OnHScroll() for a CSliderCtrl control?

387 views
Skip to first unread message

Johan Machielse

unread,
Mar 17, 2000, 3:00:00 AM3/17/00
to
Hello,

When I change the position of a slider I simultaneously want to update a
static control with the current position of the slider.
For that problem I will have to use the function OnHScroll, but it only
works for CScrollBar controls?
How can I solve this problem?

Thank you for solving my problem.

Johan Machielse

David Lowndes

unread,
Mar 17, 2000, 3:00:00 AM3/17/00
to
>When I change the position of a slider I simultaneously want to update a
>static control with the current position of the slider.
>For that problem I will have to use the function OnHScroll, but it only
>works for CScrollBar controls?

Johan,

I believe that the slider control sends WM_HSCROLL messages as well as
the scroll bars, so it should work.

What have you tried that didn't work?

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.

David Lowndes

unread,
Mar 20, 2000, 3:00:00 AM3/20/00
to
> In my application I have 2 sliders. When I move one, you can't detect in de
> function OnHScroll which one of the sliders has moved because there's a
> pointer to a CScrollbar and not to a CSliderCtrl as a parameter!

> How can I solve this problem?

Johan,

Although the parameter is defined that way, it's really just a CWnd
pointer.

Compare the window handle against that of your control. For example:

if ( GetDlgItem( IDC_SLIDER1 )->m_hWnd == pScrollBar->m_hWnd )
{
/* It's IDC_SLIDER1 */

0 new messages