How to handle the Scroll Event in a CListCtrl

Posted on 2003-03-26
Medium Priority
Last Modified: 2013-11-20
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?

Question by:Soggy
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 31

Accepted Solution

Zoppo earned 375 total points
ID: 8217579
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?


Author Comment

ID: 8296794
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.

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question