Solved

mfc CListBox hscroll

Posted on 2000-02-21
14
701 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maze travler 6 73
IdTCPClient1->Disconnect(); not working 3 92
thread-safe code in c++ 2 128
No module found pypyodbc, 3 58
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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.
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.

739 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