How to handle the Scroll Event in a CListCtrl

Im implementing an editable CListCtrl but i didnt go the subclassing route.
Mostly because im not confident ill be able to make the subclass work.

Heres what i did. I made a floating CEdit and made it float on top of the selected subitem.
Ive already done all the functionality including scrolling the list when the subitem is
barely visible.  The problem now is the presence of the horizontal/vertical scrollbar.

When the floating CEdit is visible (is being edited) and the user moves the scrollbar, the
CEdit wont move with the underlying subitem. hehe.  I dont know what event triggers when the scrollbar is being moved so i can adjust the position of the floating CEdit accordingly.

Is there a solution to this or do i really need to subclass the list control to handle the
OnHScroll or OnVScroll events?

Who is Participating?
ZoppoConnect With a Mentor Commented:
Hi Soggy,

I think there's no way round than handling the SCROLL-messages.

Allthough you could simply capture the mouse to the edit box
and end label-edit when the mouse is clicked anywhere outside
the edit-box (i.e. on the scrollbar) or when the edit box
looses the focus I don't see any possibility to avoid the
same problem with a wheel mouse. Wheel mouse messages often
are sent to the window beyond the cursor without changing
focus or mouse capture.

BTW, why do you think you'll have problems with that subclassing?

SoggyAuthor Commented:
Sorry for the long delay. Our Internet has been down for too long.  

Ive already subclassed the CListCtrl and intercepted the HScroll and VScroll. The editing functionality is still handled by the separate floating CEdit control.  
I am uneasy about subclassing the CListCtrl because of the CHeaderCtrl and the CEdit "child" controls of the list.

Im not familiar with multiple controls being subclassed that have relations to each other like the CHeaderCtrl or CEdit with respect to its parent CListCtrl. anyway thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.