How can I give a listview control in LVS_LIST style a vertical scrollbar? The default is horizontal, but I haven't found a way to use a vertical one instead. So is this possible?

Thomas
Posted on 2001-11-25 13:27:16 by Thomas
thomas i dont think this is possible. the listview control set to list will always have the contents of the listview going from left to right unlike when set to report the contents will will go from top to bottom.

just curious why would u want a vertical scrollbar anyways when the listview is set to list? if you want your content to go downwards just use report view right?
Posted on 2001-11-25 21:01:49 by smurf
I want that because in my program I have a list of users, like icq, they all have an icon (that's why I can't use a simple listbox), but it doesn't look very well when they are aranged horizontal.
I didn't use report view because I don't want the headers.. That's no problem as there's a style that hides the headers, but they are only *hidden*. Yesterday I tried all this but problems occur when resizing. The column header always has to have the size of the listview control itself. This is because otherwise the items will be cut-off. This is not so hard, but you have to account for the vertical scrollbar that might appear. However it's hard to determine if it appears:


1. listview is resized
2. column header is resized
3. vertical scrollbar might appear *now*, causing a horizontal
scroll bar as the column size is to small because the scrollbar
came in.
4. the column header has to be resized *again*, taking account
of the scrollbar.
5. vertical scrollbar stays and horizontal disappears

As you can see, the size of the column header influences the visibility of the horizontal scrollbar, and has to be adjusted, causing the horizontal scrollbar to dissappear again.
It's all a bit complicated but it results in heavy flickering scrollbars.
The solution I used now is always to substract the size of the vertical scrollbar from the column width, but when there is no scrollbar that space isn't used.. But it will do for now.

Thanks,

Thomas
Posted on 2001-11-26 03:16:26 by Thomas
I dont have a solution of your problem, but even one more problem.
The listview controls act quite different between different
versions of the comctl32.dll. Some messages and styles
act wired with some version, f.e. the icon spacing or the icon alignment.

Best way is to look with a ftp search engine and download a
bunch of different dll versions and test them all.
Posted on 2001-11-26 05:43:17 by beaster
how about try using report view. set your columns just enough so the horizonal bar doesnt show. sometimes maybe the text in your listview may exceed the width of the listview but u can implement tooltips to fix that. just a few thoughts.
Posted on 2001-11-26 11:00:48 by smurf
Well I calculate the size of the column like this:
columnsize = listviewwidth - width vertical toolbar - a few pixels for the borders.

That works okay for me, the only thing is that there will never be a horizontal scrollbar, even if the text doesn't fit, as the column header is always smaller than the listview. But I can live with that.

beaster: I hope it isn't that bad, I didn't use any weird techniques and all the constants used came from win32.hlp which isn't really new :) so I think it will work okay. Thanks for noting though.

Thanks all,

Thomas
Posted on 2001-11-26 12:00:18 by Thomas
doesn't look that bad:
Posted on 2001-11-26 12:03:31 by Thomas