Hi Guys !
Someone could tell what is wrong with the code below ?
The listview callback function is never called !
In fact I would like to catch the message WM_NOTIFY.
Can I do that inside the ListView callback function or I
should create a callback for the Dialog to have access to this
message ?
Thanks,
RValois
------------------
Someone could tell what is wrong with the code below ?
The listview callback function is never called !
In fact I would like to catch the message WM_NOTIFY.
Can I do that inside the ListView callback function or I
should create a callback for the Dialog to have access to this
message ?
Thanks,
RValois
Code:
'============================================================================== ' ' Simple DDT example of one Dialog with ListView for PB/DLL 6.0 ' '============================================================================== %NOANIMATE = 1 %NODRAGLIST = 1 %NOHEADER = 1 %NOIMAGELIST = 1 '%NOLISTVIEW = 1 %NOTABCONTROL = 1 %NOTRACKBAR = 1 %NOTREEVIEW = 1 %NOUPDOWN = 1 $Dim All #Compile Exe #Include "WIN32API.INC" #Include "COMMCTRL.INC" %IDOK = 1 %BS_DEFAULT = 1 %IDLISTVIEW = 101 %NUMCOLUMNS = 4 %NUMITENS = 10 CallBack Function OkButtonCallBack() Dialog End CbHndl End Function CallBack Function ListViewCallBack () MsgBox "Click" End Function Function PbMain () As Long Local hDlg As Long Local hListView As Long Local lvC As LV_COLUMN Local lvI As LV_ITEM Local Column As Long Local Item As Long Local SubItem As Long Local szText As Asciiz * 255 InitCommonControls ' ** Create a new dialog template Dialog New 0, "Test List View", ,, 200, 100, 0, 0 To hDlg ' ** Add controls to it Control Add Button, hDlg, %IDOK, "OK", 80, 80, 40, 15, %BS_DEFAULT Call OkButtonCallBack Control Add "SysListView32", hDlg, %IDLISTVIEW,"",5,5,190,70, _ %WS_BORDER Or %WS_CHILD Or %WS_VISIBLE Or _ %LVS_REPORT Or %LVS_SHOWSELALWAYS Call ListViewCallBack Control Send hDlg, %IDLISTVIEW, %LVM_SETEXTENDEDLISTVIEWSTYLE, 0, %LVS_EX_GRIDLINES Control Handle hDlg, %IDLISTVIEW To hListView ' ** Initialize ListView Columns lvC.mask = %LVCF_FMT Or %LVCF_WIDTH Or %LVCF_TEXT Or %LVCF_SUBITEM lvC.fmt = %LVCFMT_CENTER lvC.cx = 80 lvC.pszText = VarPtr(szText) For Column = 0 To %NUMCOLUMNS lvC.iSubItem = Column szText = "Column " & Str$(Column) If (ListView_InsertColumn(hListView, Column, lvC)=-1) Then MsgBox "Error InsertColumn" End If Next Column ' ** Add ListView Itens lvI.mask = %LVIF_TEXT Or %LVIF_PARAM lvI.stateMask = 0 lvI.iSubItem = 0 lvI.pszText = VarPtr(szText) For Item = 0 To %NUMITENS lvI.iItem = Item szText = "Item " & Str$(Item) If (ListView_InsertItem (hListView, lvI)= -1) Then MsgBox "Error InsertItem" End If Next Item ' ** Set ListView SubItem lvI.mask = %LVIF_TEXT lvI.stateMask = 0 lvI.pszText = VarPtr(szText) For Item = 0 To %NUMITENS lvI.iItem = Item For SubItem = 1 To %NUMCOLUMNS lvI.iSubItem = SubItem szText = "SubItem " & Str$(Item) & Str$(SubItem) If (ListView_SetItem (hListView, lvI)= -1) Then MsgBox "Error SetItem" End If Next SubItem Next Item ' ** Display the dialog Dialog Show Modal hDlg End Function
------------------
Comment