Link to home
Start Free TrialLog in
Avatar of sdynan
sdynan

asked on

Scrolling Child Windows In Subclassed CListCtrl

I want to use a CListCtrl in Report View to display audio items in column one and their respective volumes as horizontal sliders in column two.  So I subclassed a CListCtrl and called it CSliderListCtrl.  I have overridden the InsertItem() method which calls CListCtrl::InsertItem() and then goes on to create a CSliderCtrl and displays it in the RECT beside the newly inserted list item, i.e. in column two.  But when the list needs to scroll, I have to explicitly call MoveWindow() for every slider in (and out of) view to get them to cleanly scroll alongside their correspondng list items.  If each slider is a child window of my derived list control, why won't Windows do the scrolling and redrawing for me?  My solution is a very clunky one and looks a bit sad on slower displays.  Is there an alternative way?  Maybe owner-drawn items?
Avatar of RONSLOW
RONSLOW

Owner drawn items needs the latest IE4 COMCTL32, and are not directly supported by MFC (yet).

You could try using 'icons' on each line that show your volume level .. the selection of which icon to disaply for each line can be done with a callback, so you could have a set of bar pictures in an image list, with one picture for each number of bars (eg. no bars, on bar, two bar etc).

Then the callback for the icon to use would select the approriate icon based on the volume level

Avatar of sdynan

ASKER

Well, my *real* question was why Windows doesn't correctly scroll my sliders when the list control scrolls.  Each slider has its own unique control ID and is a child window of the list control.  Windows makes an attempt to move the bitmap images of the sliders, so it initially looks like it almost works, but forcing a redraw of the list control reveals the sliders in their original positions.  It's almost like each slider needs to be a child window of a list ITEM rather than the list control itself.
ASKER CERTIFIED SOLUTION
Avatar of RONSLOW
RONSLOW

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sdynan

ASKER

Thanks.  That was what I was afraid of.

Sean.