?
Solved

Scrolling Child Windows In Subclassed CListCtrl

Posted on 1998-04-23
4
Medium Priority
?
578 Views
Last Modified: 2013-11-19
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?
0
Comment
Question by:sdynan
[X]
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
  • 2
  • 2
4 Comments
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1301675
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

0
 

Author Comment

by:sdynan
ID: 1301676
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.
0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 150 total points
ID: 1301677
That is not how scrollbars work.  The scrollbar sends scroll info to the window (the list view) and the window repaints itself accordingly.  It doesn't even necessarily have to scroll - it can just repaint with the new info - it all depends on how the window responds to the messages.

For example, If you look at the code for CScrollView, it 'manually' scrolls all the child windows.

You have to scroll yourself.

But you might like to SetRedraw(false) before andSetRedraw(true);Invalidate() afterward to avoid flicker.

0
 

Author Comment

by:sdynan
ID: 1301678
Thanks.  That was what I was afraid of.

Sean.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

752 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