Setting FullRowSelect on a ListView Control 
Author Message
 Setting FullRowSelect on a ListView Control

 Does anyone have any ideas on how to set the full row highlight for a
ListView Control ? According to MSDN the following code should work, but
I've had no luck.

Private Const LVM_FIRST = &H1000
Private Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
Private Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
'
Private Const LVS_EX_GRIDLINES = &H1
Private Const LVS_EX_SUBITEMIMAGES = &H2
Private Const LVS_EX_CHECKBOXES = &H4
Private Const LVS_EX_TRACKSELECT = &H8
Private Const LVS_EX_HEADERDRAGDROP = &H10
Private Const LVS_EX_FULLROWSELECT = &H20   '   Applies to report mode only
Private Const LVS_EX_ONECLICKACTIVATE = &H40
Private Const LVS_EX_TWOCLICKACTIVATE = &H80
'
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hWnd As Long, wMsg As Long, wParam As Long, lParam As Long) As Long
'
Public Sub SetFullRowHighlight(ByRef oListView As ListView, Optional ByVal
FullRowOn As Variant)
    If Not oListView.View = lvwReport Then Exit Sub
    '
    Dim dwExStyle As Long
    '
    If IsMissing(FullRowOn) Then FullRowOn = True
    '
    '   Get the current style settings for the control
    dwExStyle = SendMessage(oListView.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0,
0)
    '
    '   Reset the style settings so that fullrowselect style is modified
    If FullRowOn = True Then
        Call SendMessage(oListView.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0,
dwExStyle Or LVS_EX_FULLROWSELECT)
    Else
        Call SendMessage(oListView.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0,
dwExStyle Or Not LVS_EX_FULLROWSELECT)
    End If
End Sub

If it is down to the version of the ComCtl32.dll or OCX these are what I
have got;

ComCtl32.dll        Date        : Saturday, 12 July, 1997
                                Version   : 4.71.1008.3

ComCtl32.ocx     Date         : Saturday, 19 July, 1997 5:00:28 pm
                                Version   : 5.01.4319



Sat, 11 Mar 2000 03:00:00 GMT  
 Setting FullRowSelect on a ListView Control

Go to http://home.sprynet.com/sprynet/rasanen/vbnet/default.htm, select the
Common Ctrls hyperlink, and scroll down to the ListView extended style demo
called "How to select the entire row in a ListView".

While you're there, check out the other demos.  This is a fabulous
resource.  Kudos to Mr. Birch!

earl



Sat, 11 Mar 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem Setting Listview's FullRowSelect Style

2. Fullrowselect in ListView-control (VB4 32)

3. ListView control and FullRowSelect

4. listview & fullrowselect

5. How to select entire row in ListView ? - FullRowSelect

6. Listview - Columns, FullrowSelect & RightAlign

7. Listview - Columns, FullrowSelect & RightAlign

8. Listview - Columns, FullrowSelect & RightAlign

9. Anyone gotten ListView SubItemImages + FullRowSelect + Sorting working?

10. Fullrowselect in listview

11. Listview - FullRowSelect

12. How to set up XP groups in a listview control

 

 
Powered by phpBB® Forum Software