Solved

mfc CListBox hscroll

Posted on 2000-02-21
14
698 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
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!

 
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
 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
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 video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

679 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