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,hConsole As Dword, NewRow,LastRow As Long
Function PBMain() As Long
Dialog New Pixels, 0, "ListView Test",300,300,245,95,%WS_SysMenu, 0 To hDlg
Control Add ListView, hDlg, %IDC_ListView, "", 10,10,175,75 '225
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 iResult As Long
Select Case Cb.Msg
Case %WM_InitDialog
LastRow = -1 : NewRow = 2
ListView Select hDlg, %IDC_ListView, NewRow
Case %WM_Notify
Select Case Cb.NmId
Case %IDC_ListView
Select Case Cb.NmCode
Case %LVN_ItemChanged
LastRow = NewRow
ListView Get Select hDlg, %IDC_ListView To iResult
If iResult <> 0 Then NewRow = iResult
Dialog Set Text hDlg, Str$(NewRow) + Str$(LastRow) 'display the row in the title bar
End Select
End Select
End Select
End Function
'gbs_01015
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm