Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile Exe
#Dim All
%Unicode=1
#Include "win32api.inc"
%IDC_ListView = 500
Global hDlg,hListView As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "ListView Test",300,300,350,150,%WS_SysMenu, 0 To hDlg
Control Add ListView, hDlg, %IDC_ListView, "", 10,10,175,125,, %WS_Ex_ClientEdge '225
Control Handle hDlg, %IDC_ListView To hListview
ListView Set StyleXX hDlg, %IDC_ListView, %LVS_Ex_CheckBoxes Or %LVS_Ex_GridLines Or %LVS_Ex_FullRowSelect
ListView Insert Column hDlg, %IDC_ListView, 1, "test1", 175, 0
ListView Insert Item hDlg, %IDC_ListView, 1, 0, "one" 'row 1, col1
ListView Insert Item hDlg, %IDC_ListView, 2, 0, "two" 'row 2, col1
ListView Insert Item hDlg, %IDC_ListView, 3, 0, "three" 'row 3, col1
ListView Insert Item hDlg, %IDC_ListView, 4, 0, "four" 'row 4, col1
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local LVHT As LVHitTestInfo
Select Case Cb.Msg
Case %WM_Notify
Select Case Cb.NmId
Case %IDC_ListView
Select Case Cb.NmCode
Case %NM_Click
GetCursorPos LVHT.pt
ScreenToClient hListView, LVHT.pt
Control Send hDlg, %IDC_ListView, %LVM_SubItemHitTest, 0, VarPtr(LVHT)
If (LVHT.pt.x < 5) Or (LVHT.pt.x > 17) Then Exit Select
Dialog Set Text hDlg, "Row " + Str$(LVHT.iItem+1) + " was clicked"
End Select
End Select
End Select
End Function
'gbs_01240
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm