CListBox - controlling horizonall scroll

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I am deriving a control from an owner draw CListBox.

I set the width of the list with SetHorizontalExtent()

It is wider than its client area and I get horizontal scroll bar as
desired.

Now when I press a given key I want it to scroll horizontally to a
position I have calculated.

I am catching the key press with VKeyToItem() - so far so good.

But trying to get it to scroll is driving me mad!

Any ideas on how to achieve this?

Dave
--
David Webber
Author MOZART the music processor for Windows -
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm

[PS My first guess was

SetScrollPos( SB_HORZ, nPos, FALSE );
SendMessage( WM_HSCROLL, WPARAM(SB_THUMBPOSITION), LPARAM(0) );

but whatever nPos is the OnHScroll() handler receives nPos=0 and
nothing happens. ]


.



Relevant Pages

  • Re: Scrollbar thumbtrack doesnt scroll all the way
    ... SetWindowPos in regards to an embedded child window. ... Note also that OnSize is ... The size of the scroll bar in between is largely irrelevant to ... The correct value is to use nPos. ...
    (microsoft.public.vc.mfc)
  • Re: Scrollbar thumbtrack doesnt scroll all the way
    ... SetWindowPos in regards to an embedded child window. ... Note also that OnSize is ... The size of the scroll bar in between is largely irrelevant to ... The correct value is to use nPos. ...
    (microsoft.public.vc.mfc)
  • Re: Scrollbar thumbtrack doesnt scroll all the way
    ... It is not very practical to create a window that is larger than the current screen ... The correct value is to use nPos. ... You can get the scroll position directly from the control. ... If the user clicks the thumbtrack, ...
    (microsoft.public.vc.mfc)
  • Re: How do you turn scroll bars on in Word 2007
    ... The horizontal scroll bar is only visible when the display resolution is ... such that the full width of the page is not visible in the Word window. ...
    (microsoft.public.word.docmanagement)
  • Re: How do you turn scroll bars on in Word 2007
    ... My horizontal scroll bar disappears when the zoom is less than or ... I sometime need the horizontal control even the, ... Can I force the scroll ball ... follow-ups to the newsgroup so all may benefit. ...
    (microsoft.public.word.docmanagement)