PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Sean Roe on May 04, 2011, 03:07:47 PM

Title: Error when using ListView
Post by: Sean Roe on May 04, 2011, 03:07:47 PM
I get the following message when trying to compile using PB10 and a ListView in FF3. I have removed the ListView from my project but still won't let me compile and complains with the same erorr. I can't remove the form the listview was on, FF3 stops working. I delete the generated files after every successful compile. Any ideas?

The Lines from Utility.inc:
Function FF_ListView_InsertItem( ByVal hWndControl As Dword, _
                                 ByVal iRow    As Long, _        <====== causing error
                                 ByVal iColumn As Long, _
                                 ByVal TheText As String, _
                                 Optional ByVal lParam As Long, _
                                 Optional ByVal iImage As Long _
                                 ) As Long

    Local tlv_item As LV_ITEM


And From Jose's OLEDB.inc

' ########################################################################################
' IRow interface
' IID = 0C733AB4-2A1C-11CE-ADE5-00AA0044773D
' Inherited interface = IUnknown
' ########################################################################################

#IF NOT %DEF(%IRow_INTERFACE_DEFINED)
    %IRow_INTERFACE_DEFINED = 1

]Interface IRow $IID_IRow  <====== causing error

   INHERIT IUnknown

   ' =====================================================================================
   METHOD GetColumns ( _                                ' VTable offset = 12
     BYVAL cColumns AS DWORD _                          ' __in DBORDINAL cColumns
   , BYREF rgColumns AS DBCOLUMNACCESS _                ' __inout DBCOLUMNACCESS rgColumns[  ]
   ) AS LONG                                            ' HRESULT
   ' =====================================================================================



Title: Re: Error when using ListView
Post by: José Roca on May 04, 2011, 05:16:58 PM
Change ByVal iRow As Long to something else, e.g. ByVal iRow_ As Long.
Title: Re: Error when using ListView
Post by: Sean Roe on May 04, 2011, 08:18:08 PM
Thank you Jose.

Just learned something new and powerful about FireFly. I am posting what I have done here so if anyone else runs up against this, hopefully this would add clarity.

What Jose is talking about is changing the definition in the functions library. At first I kept thinking how would changing a generated file help. But then in dawned on me that the generated file is reading out of the FF3 function library and I have access to that. So I went in there and modified the appropriate and offending code. Here is my modifications
Function FF_ListView_InsertItem( ByVal hWndControl As Dword, _
                                 ByVal iRow_    As Long, _         
                                 ByVal iColumn As Long, _
                                 ByVal TheText As String, _
                                 Optional ByVal lParam As Long, _
                                 Optional ByVal iImage As Long _
                                 ) As Long

    Local tlv_item As LV_ITEM

    ' Do a check to ensure that this is actually a window handle
    If IsWindow(hWndControl) Then 
        tlv_item.iItem     = iRow_
        tlv_item.iSubItem  = iColumn
        tlv_item.pszText   = StrPtr(TheText)
        tlv_item.iImage    = iImage
        tlv_item.lParam    = lParam
       
        If iColumn = 0 Then
           tlv_item.mask      = %LVIF_TEXT Or %LVIF_PARAM Or %LVIF_IMAGE
           Function = SendMessage( hWndControl, %LVM_INSERTITEM, 0, ByVal VarPtr(tlv_item))
        Else
           tlv_item.mask      = %LVIF_TEXT Or %LVIF_IMAGE
           Function = SendMessage( hWndControl, %LVM_SETITEM, 0, ByVal VarPtr(tlv_item))
        End If
    End If

   
End Function


I changed iRow to iRow_ in two places in FF_ListView_InsertItem function. Now everything is back to compiling and working.   :D
Title: Re: Error when using ListView
Post by: Douglas McDonald on May 05, 2011, 10:16:10 AM
Can this just be changed just once in the FF_ListView_InsertItem.inc file or do I have to remember to change it every time I use the function?

Thanks
Title: Re: Error when using ListView
Post by: Marc van Cauwenberghe on May 05, 2011, 10:25:08 AM
It can be changed just once in the FF_ListView_InsertItem.inc, but it is up to Paul to make this permanently.
It will always be overwriten when there is a new FF update.

Marc