List View Width and Scroll Question 
Author Message
 List View Width and Scroll Question

I have a problem with the list view control...

What I need is a single column list, with a check boxes, multi-select, and
scrolling vertically...

When I use the ListView control I have several problems.  1) the column
width is truncated.  2) When the list is full (vertically) it
puts new items to the right of the top item and uses a horizontal scroll bar
instead of adding items underneath and using a vertical scroll bar...

I saw some posts on the newsgroup about setting the column width using
sendmessage, but this either crashes my pc or does nothing... so I guess I
missed something...  I'm using lvList by the way, and its VB6 SP3.

Anyway the question is this:  Can the list view control do what I want? or
should I be using a different control?

Thanks
Andy Nield



Mon, 29 Jul 2002 03:00:00 GMT  
 List View Width and Scroll Question
Andy,

Quote:
>What I need is a single column list, with a check boxes, multi-select, and
>scrolling vertically...

So why not use a Listbox then? It can do all that, with the help from
this code:

Displaying the Horizontal Scroll Bar in a ListBox
http://www.mvps.org/vbnet/code/listapi/sethorizontalextent.htm

Quote:
>2) When the list is full (vertically) it puts new items to the right of the
>top item and uses a horizontal scroll bar instead of adding items underneath
>and using a vertical scroll bar...

Set the style to Report instead of List.

Mattias

__________________________________________________

     VB+ http://hem.spray.se/mattias.sjogren/
 Please send questions/replies to the newsgroups



Mon, 29 Jul 2002 03:00:00 GMT  
 List View Width and Scroll Question
Thanks, changing the style setting to Report and then adjusting the
columnheadings width sorted it.

I didn't think the Listbox could do check boxes and multi select at the same
time... I'm sure there was a reason why I had to use listview instead.

Thanks
Andy Nield


Quote:
> Andy,

> >What I need is a single column list, with a check boxes, multi-select,
and
> >scrolling vertically...

> So why not use a Listbox then? It can do all that, with the help from
> this code:

> Displaying the Horizontal Scroll Bar in a ListBox
> http://www.mvps.org/vbnet/code/listapi/sethorizontalextent.htm

> >2) When the list is full (vertically) it puts new items to the right of
the
> >top item and uses a horizontal scroll bar instead of adding items
underneath
> >and using a vertical scroll bar...

> Set the style to Report instead of List.

> Mattias

> __________________________________________________

>      VB+ http://hem.spray.se/mattias.sjogren/
>  Please send questions/replies to the newsgroups



Mon, 29 Jul 2002 03:00:00 GMT  
 List View Width and Scroll Question
Andy ... If you want that single-columned report-style listview to
automagically assume the full width of the control, call this from some
logical place....

   Const LVSCW_AUTOSIZE_USEHEADER = -2

   Call SendMessage(ListView1.hwnd, _
                          LVM_SETCOLUMNWIDTH, _
                          0, _
                          ByVal LVSCW_AUTOSIZE_USEHEADER)

If you add more columns, use this instead ...

   Const LVSCW_AUTOSIZE_USEHEADER = -2
   Dim col2adjust As Long

   For col2adjust = 0 To ListView1.ColumnHeaders.Count - 1

      Call SendMessage(ListView1.hwnd, _
                          LVM_SETCOLUMNWIDTH, _
                          col2adjust, _
                          ByVal LVSCW_AUTOSIZE_USEHEADER)

   Next

--

Randy Birch, MVP Visual Basic

http://www.mvps.org/vbnet/
http://www.mvps.org/ccrp/


| Thanks, changing the style setting to Report and then adjusting the
| columnheadings width sorted it.
|
| I didn't think the Listbox could do check boxes and multi select at the
same
| time... I'm sure there was a reason why I had to use listview instead.
|
| Thanks
| Andy Nield
|


| > Andy,
| >
| > >What I need is a single column list, with a check boxes, multi-select,
| and
| > >scrolling vertically...
| >
| > So why not use a Listbox then? It can do all that, with the help from
| > this code:
| >
| > Displaying the Horizontal Scroll Bar in a ListBox
| > http://www.mvps.org/vbnet/code/listapi/sethorizontalextent.htm
| >
| >
| > >2) When the list is full (vertically) it puts new items to the right of
| the
| > >top item and uses a horizontal scroll bar instead of adding items
| underneath
| > >and using a vertical scroll bar...
| >
| > Set the style to Report instead of List.
| >
| >
| > Mattias
| >
| > __________________________________________________

| >      VB+ http://hem.spray.se/mattias.sjogren/
| >  Please send questions/replies to the newsgroups
|
|



Mon, 29 Jul 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Change Scroll Bar Width In List Box?

2. Column width of List view

3. Column width of List view

4. list view - scroll

5. List View Horizontal Scroll

6. Stop scrolling in a list view?

7. Scrolling the List View control

8. name of one list item is longer than the width of the list box

9. List View Question ( Any Help appreciated!)

10. List View Question

11. List Box Scrolling Question

12. List View Sort Question

 

 
Powered by phpBB® Forum Software