Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
%Unicode=1
#Include "win32api.inc"
Global hDlg As Dword 'main dialog handle
Function PBMain() As Long
Dialog New Pixels, 0, "ListView Test",300,300,200,140,%WS_OverlappedWindow To hDlg
Control Add ListView, hDlg, 100, "", 10,10,180,120
ListView Insert Column hDlg, 100, 1, "test1", 90, 0
ListView Insert Column hDlg, 100, 2, "test2", 90, 0
ListView Insert Item hDlg, 100, 1, 0, "one" 'row,image
ListView Insert Item hDlg, 100, 2, 0, "two" 'row,image
ListView Insert Item hDlg, 100, 3, 0, "three" 'row,image
ListView Set Text hDlg, 100, 1,2, "12" 'row1 col2
ListView Set Text hDlg, 100, 2,2, "22" 'row2 col2
ListView Set Text hDlg, 100, 3,2, "33" 'row2 col2
ListView Set StyleXX hDlg, 100, %LVS_Ex_GridLines Or %LVS_Ex_FullRowSelect
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local iRow,iCol As Long, temp$, LVNT As NMItemActivate Ptr
Select Case Cb.Msg
Case %WM_Notify
Select Case Cb.NmId
Case 100
Select Case Cb.NmCode
Case %NM_DblClk 'notification to ask for data
LVNT = Cb.LParam 'pointer to LVDISPINFO structure for requested subitem
iRow = @LVNT.iItem+1 'row being asked for
iCol = @LVNT.iSubItem+1 'sub item being asked for (columns)
ListView Get Text hDlg, 100, iRow,iCol To temp$
Dialog Set Text hDlg, Str$(iRow) + Str$(iCol) + " " + temp$
End Select
End Select
End Select
End Function
http://www.garybeene.com/sw/gbsnippets.htm