Solved

Subclassing the Horizontal scroll-bar of a CListCtrl

Posted on 2002-06-27
9
516 Views
Last Modified: 2013-11-20
Hi,
I need to replace the horizontal scroll-bar of a CListCtrl in a horizontal scroll bar of my own (I need a different behaviour from the normal).
I tried to place a CControlBar control exactly in the position of the default control-bar but it does not work because every time the default control-bar pops up, it pop in front of my control-bar.
I think that what I need to do is somehow to block the setting of WS_HSCROLL style (which is set every time that the control can scroll and disappear whenever scrolling can not be done).
Can someone tell me how can I block the poping of the default Horizontal scroll-bar ?

Thanks,
Yoav.
0
Comment
Question by:yoavo
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 1

Expert Comment

by:gurly
Comment Utility
Maybe CWnd::EnableScrollBarCtrl(SB_HORZ, FALSE) can help you ?
0
 

Author Comment

by:yoavo
Comment Utility
I tried it but the default scroll-bar keeps coming...
0
 
LVL 1

Expert Comment

by:gurly
Comment Utility
If you can catch the message that cause the scrollbar to be created, maybe you can than cal GetScrollBar and destroy it ?
0
 

Expert Comment

by:spanasik
Comment Utility
You must subclass your window(CListCtrl).
Try to read at www.codeproject.com great article from Chris Maunder "Create your own controls - the art of subclassing".
http://www.codeproject.com/miscctrl/subclassdemo.asp
IMHO this is a right way.
I don't include any code, because i don't subclass any CListCtrl in my projects, but in given article Chris subclass a button and explain in detail whole process.
Hope this help you !

Stas.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:yoavo
Comment Utility
This answer is too general. I know what subclassing is...
0
 
LVL 4

Expert Comment

by:mblat
Comment Utility
I am wondering....

If you need different from default behaivour for horizontal scrool bar why can't you handle WM_HSCROLL the way you want, without calling default implementation?


Or you need different apperance also, not just behaviour?
0
 

Author Comment

by:yoavo
Comment Utility
need different apperance also...
0
 
LVL 4

Expert Comment

by:mblat
Comment Utility
Of cause one way to do that would be to impelement owner draw list ctrl. There are some samples of it on codeguru.com.  

Since it is not exactly what you wanted let me see if I can come up with something else....
0
 
LVL 4

Accepted Solution

by:
mblat earned 100 total points
Comment Utility
Problem here is that scroll bar in list view isn't scroll bar at all. :-(
It is just painted area inside the control that behave like scroll bar.
My guess would be that it comes from Win3.1 days when it was too expensive to create 2 extra controls.

So unless you go owner-draw route I don't think you can do what you want. :-(
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now