Solved

mfc CListBox hscroll

Posted on 2000-02-21
14
677 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

914 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

12 Experts available now in Live!

Get 1:1 Help Now