Solved

mfc CListBox hscroll

Posted on 2000-02-21
14
683 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SendMessage fails while PostMessage works 2 114
Grammars for C C++ and java 1 122
Path to  STL Map header file 1 57
What is sub-make ? 2 58
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

786 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