Solved

Scrolling Child Windows In Subclassed CListCtrl

Posted on 1998-04-23
4
538 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
  • 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 50 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FizzBuzz challenge 9 82
wordmultiple challenge 12 140
how to split multiple lines delimiter : 8 109
x-bar in Google Sheets 2 69
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

809 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