Solved

mfc CListBox hscroll

Posted on 2000-02-21
14
671 Views
Last Modified: 2011-04-14
Hello,

I have created an activeX control which has a :
CListBox      m_ListBox;
in it.

I also custom paint some extra (big) scroll buttons next to it.
When I press the left or right scroll I want to do a (very suprisingly) left or right scroll.

I have done this by sending the CListBox a:

WPARAM wPAram = SB_PAGELEFT;
m_ListBox.SendMessage(WM_HSCROLL, wPAram,NULL );

This works fine if I add my control to a dialog, but when I use my control in a webbrowser ( <OBJECT=... ) this doesn't work.

Can anybody tell me how I can overcome this problem. (Or why it is doing this )

Thanks,
Tom
0
Comment
Question by:tomschuring
  • 8
  • 3
  • 2
  • +1
14 Comments
 

Author Comment

by:tomschuring
ID: 2548797
Adjusted points to 400
0
 

Author Comment

by:tomschuring
ID: 2548798
The main problem here is scrolling horizontal I guess...
0
 

Expert Comment

by:cclain
ID: 2549617
I tried it and it's working fine in both case. Is it really working in a dialog ? Need more information about the control styles...
0
 
LVL 1

Expert Comment

by:BigOne
ID: 2551875
Hmmm, Have you tried more than one web browser?  Just a thought...
0
 

Author Comment

by:tomschuring
ID: 2552124
It works fine if I place the control on a dialog. Here follows the create of the CListBox

CRect theSize(0,0,200,200);

m_ListBox.Create( WS_BORDER | LBS_NOINTEGRALHEIGHT ,theSize            ,this ,(UINT)255 );

Where this is my own class derived of COleControl (created by the MFC ActiveX control wizard)

I have tried it on two different installations of IE4.02 everything displays fine only the horizontal scroll doesn't work in the browser control. The vertical works because I do that one via SetTopIndex(..).
0
 

Expert Comment

by:cclain
ID: 2553612
Are you sure horizontal scroll is working in a simple mfc application ?
0
 

Author Comment

by:tomschuring
ID: 2553650
Yes, I just created a dialog based MFC-app added the controll and it is very happy scrolling left and right.

Is there something that I should know about ?
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Expert Comment

by:cclain
ID: 2553680
I just can't see the difference between my control in a MFC-app and in IE5. What about installing IE5...
0
 

Author Comment

by:tomschuring
ID: 2553693
a bit more tricky. The browser-control is running inside an app that has been distributed on multiple kiosks. It can be done but would be a bit task to upgrade all machines to IE5. I'll try a version of it on an IE5 machine first.
0
 

Author Comment

by:tomschuring
ID: 2556349
Adjusted points to 450
0
 

Author Comment

by:tomschuring
ID: 2556350
I made a class that is derived from CListBox and added the WM_HSCROLL message handler to it. The message handler get's called but I don't see any movement in the listbox.
0
 
LVL 1

Expert Comment

by:BigOne
ID: 2557919
As a test try adding the WS_HSCROLL Style to your create call...I know this is not what you want, but do the styles get applied differently inside the browser?  It might be an additional clue.  I will try to find additional info about this.
0
 
LVL 4

Accepted Solution

by:
wylliker earned 450 total points
ID: 2561781
Have you called CListBox::SetHorizontalExtent?


Remarks

Sets the width, in pixels, by which a list box can be scrolled horizontally. If the size of the list box is smaller than this value, the horizontal scroll bar will horizontally scroll items in the list box. If the list box is as large or larger than this value, the horizontal scroll bar is hidden.

To respond to a call to SetHorizontalExtent, the list box must have been defined with the WS_HSCROLL style.  

This member function is not useful for multicolumn list boxes. For multicolumn list boxes, call the SetColumnWidth member function.



Also, from the LB_SETHORIZONTALEXTENT message docs

Remarks
To respond to the LB_SETHORIZONTALEXTENT message, the list box must have been defined with the WS_HSCROLL style.

Note that a list box does not update its horizontal extent dynamically.


If you are adding items to the list box, then I think the last Note above may apply, in that you need to update the horizontal extent if you have grown wider since it was last set.

0
 

Author Comment

by:tomschuring
ID: 2563331
Hello All, I have to appologise. It wasn't the settings, it was the data. The data was given to the ActiveX object via the html file and in there all the list items were just big enough to fit in the box. (or sometimes just half a letter too big) so when I requested a page right, the control would say "but there is no more right space). Dumb, Dumb, Dumb, Anyway thanks for all the support. I'm just going to give the points away...
Tom
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

757 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

20 Experts available now in Live!

Get 1:1 Help Now