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"
%IDC_Button = 500
%IDC_ListView = 600
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 Button, hDlg, %IDC_Button, "Push",10,10,100,20
Control Add ListView, hDlg, %IDC_ListView, "", 10,40,180,80
ListView Insert Column hDlg, %IDC_ListView, 1, "test1", 90, 0
ListView Insert Column hDlg, %IDC_ListView, 2, "test2", 90, 0
ListView Insert Item hDlg, %IDC_ListView, 1, 0, "one" 'row,image
ListView Insert Item hDlg, %IDC_ListView, 2, 0, "two" 'row,image
ListView Insert Item hDlg, %IDC_ListView, 3, 0, "three" 'row,image
ListView Set Text hDlg, %IDC_ListView, 1,2, "12" 'row1 col2
ListView Set Text hDlg, %IDC_ListView, 2,2, "22" 'row2 col2
ListView Set Text hDlg, %IDC_ListView, 3,2, "33" 'row2 col2
ListView Set StyleXX hDlg, %IDC_ListView, %LVS_Ex_GridLines Or %LVS_Ex_FullRowSelect
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local temp$, iPos As Long
Select Case Cb.Msg
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Button
If Cb.CtlMsg = %BN_Clicked Then
Do
Incr iPos
ListView Get Select hDlg, %IDC_ListView, iPos To iPos
If iPos Then temp$ = temp$ + Str$(iPos)
Loop While iPos
? temp$
End If
End Select
End Select
End Function
'gbs_01243
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm