Listview Full Row Select 
Author Message
 Listview Full Row Select

I recently posted help on the listview control asking how  to implement
full row select.  A reply came back with the below information.  It worked,
SOME of the time.  If I implement the code and press F5 to run it works.
If I click on the RUN toolbar button it doesn't work.  If I make an exe and
run it, it doesn't work.  Is this a bug or am I missing something?

Declare Function SendMessge Lib "user32" Alias "SendMessageA" (ByVal hwnd _
        As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam as Long ) _
        As Long

Public Const LVM_FIRST = &H1000
Public Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
Public Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
Public Conts LVS_EX_FULLROWSELECT = &H20

Place the following code on the Form_Load where the ListView control is
contained (ListView1).
----------------------------------------------------------------------------

Dim style as Long
Dim result as Long

style = SendMessage(ListView1.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
style = style Or LVS_EX_FULLROWSELECT
result = SendMessage(ListView1.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0,
style)



Sun, 27 Jun 1999 03:00:00 GMT  
 Listview Full Row Select

Here is a snipet from a sample app that you might try.  I created the app
based on the information you received the other day.  Regards to Chris
Coursey for the help.

Keep the following declare and const's in a module ( assuming you have them
both there).

Quote:
> Declare Function SendMessge Lib "user32" Alias "SendMessageA" (ByVal hwnd
_
>    As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam as Long )
_
>    As Long

> Public Const LVM_FIRST = &H1000
> Public Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
> Public Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
> Public Conts LVS_EX_FULLROWSELECT = &H20

The rest of my code just builds on what Chris sent the other day.  I don't
know if it is going to work but give it a try.  

Quote:
> Place the following code on the Form_Load where the ListView control is
> contained (ListView1).

Private Sub Form_Load()
Dim itmX As ListItem
Dim result As Long
Dim style As Long

    style = SendMessage(ListView1.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
    style = style Or LVS_EX_FULLROWSELECT
    result = SendMessage(ListView1.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0,
style)

    ' Create an object variable for the ColumnHeader object.
    Dim clmX As ColumnHeader
    ' Add ColumnHeaders. The width of the columns is the width
    ' of the control divided by the number of ColumnHeader objects.
    Set clmX = ListView1.ColumnHeaders.Add(, , "Column1", 2000)
    Set clmX = ListView1.ColumnHeaders.Add(, , "Column2", 1500,
lvwColumnCenter)
    'load a few items into the Listview so you can see the selected item
    Set itmX = ListView1.ListItems.Add(, , "Column1")
    itmX.SubItems(1) = "Column2"
    Set itmX = ListView1.ListItems.Add(, , "Column1")
    itmX.SubItems(1) = "Column2"
    Set itmX = ListView1.ListItems.Add(, , "Column1")
    itmX.SubItems(1) = "Column2"
    Set itmX = ListView1.ListItems.Add(, , "Column1")
    itmX.SubItems(1) = "Column2"

    ListView1.View = lvwReport ' Set View property to Report.

    Set itmX = ListView1.ListItems.Item(1)
    itmX.Selected = True
    itmX.EnsureVisible

End Sub



Sun, 27 Jun 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. listview full row select not working on w95

2. ListView - Full Row Select

3. ListView Full row select

4. Full row select does not always!?

5. List View and full row select

6. LIST VIEW FULL ROW SELECT IN EXE ?

7. Full row selection in MSHflexgrid does not select first column

8. ListView Full Row Selections

9. Full row in ListView

10. Change full row forecolor for a listitem in listview

11. Listview full row not working on w95

12. ListView Full Row Selection

 

 
Powered by phpBB® Forum Software