I a trying to implement a TreeView and use Jose's functions. When I include the latest TreeViewCtrl.inc file (from the link in the 3.71 release notice here) as a module I get this error:
"THIS NAME IS ALREADY IN USE"
But it does not seem to reference any specific line.
I tried an older version of the TreeViewCtrl.inc and it would compile but the function to count the items always returned zero.
Suggestions?
Thanks
Can we know which name is already in use?
Mark,
Did you try compiling in the PB IDE?
FireFly does NOT report the name correctly that I can see because it positions the cursor to a random spot in the code. I tried compiling per David's suggestion and I get a different error.
Compiling "C:\mstrickland\FF3-Source\TreeViewDemo\release\CODEGEN_TREEVIEWDEMO_MAIN.bas"
Error 493 in C:\mstrickland\FF3-Source\TreeViewDemo\release\CODEGEN_TREEVIEWDEMO_MAIN.bas(31:015): Compiler file not found/accessible
Line 31: #Include Once "GDIPlus.inc"
This is in the generated code from FF
So I have simply attached the whole project as a ZIP file. It is just a test project to see if I could use Jose's function calls. Take a look at the simple function call attached to the only button in the project.
I suppose this could be a problem with my PB10 and/or the environment path I have set. But I don't have any trouble with other projects (but they do NOT use Jose's functions).
Thanks for the help.
From this code:
#If %DEF(%USEPBDECL)
Function TreeView_GetISearchStringA (ByVal hwndTV As Dword, lpsz As Asciiz) As Long
Function = SendMessage(hwndTV, %TVM_GETISEARCHSTRINGA, 0, VarPtr(lpsz))
End Function
Function TreeView_GetISearchStringW (ByVal hwndTV As Dword, lpsz As wStringZ) As Long
Function = SendMessage(hwndTV, %TVM_GETISEARCHSTRINGW, 0, VarPtr(lpsz))
End Function
#Else
' ========================================================================================
' Gets the incremental search string of a list-view control.
' ========================================================================================
Function TreeView_GetISearchStringA (ByVal hwndTV As Dword) As String
Local nLen As Long
Local strSearch As String
nLen = SendMessageA(hwndTV, %TVM_GETISEARCHSTRINGA, 0, ByVal %Null)
strSearch = Space$(nLen + 1)
nLen = SendMessageA(hwndTV, %TVM_GETISEARCHSTRINGA, 0, ByVal StrPtr(strSearch))
Function = Left$(strSearch, nLen)
End Function
' ========================================================================================
' ========================================================================================
FUNCTION TreeView_GetISearchStringW (BYVAL hwndLV AS DWORD) AS WSTRING
Local nLen As Long
Local bstrSearch As wString
nLen = SendMessageW(hwndLV, %TVM_GETISEARCHSTRINGA, 0, ByVal %Null)
bstrSearch = Space$(nLen + 1)
nLen = SendMessageW(hwndLV, %TVM_GETISEARCHSTRINGW, 0, ByVal StrPtr(bstrSearch))
Function = Left$(bstrSearch, nLen)
End Function
' ========================================================================================
#EndIf
#If %DEF(%UNICODE)
' Macro TreeView_GetISearchString = TreeView_GetISearchStringW ' moved to Declare include file.
#Else
' Macro TreeView_GetISearchString = TreeView_GetISearchStringA ' moved to Declare include file.
#EndIf
FireFly has generated these declares:
Declare Function TreeView_GetISearchStringA (ByVal hwndTV As Dword, lpsz As Asciiz) As Long
Declare Function TreeView_GetISearchStringW (ByVal hwndTV As Dword, lpsz As wStringZ) As Long
Declare Function TreeView_GetISearchStringA (ByVal hwndTV As Dword) As String
Declare FUNCTION TreeView_GetISearchStringW (BYVAL hwndLV AS DWORD) AS WSTRING
It should be:
#If %DEF(%USEPBDECL)
Declare Function TreeView_GetISearchStringA (ByVal hwndTV As Dword, lpsz As Asciiz) As Long
Declare Function TreeView_GetISearchStringW (ByVal hwndTV As Dword, lpsz As wStringZ) As Long
#Else
Declare Function TreeView_GetISearchStringA (ByVal hwndTV As Dword) As String
Declare FUNCTION TreeView_GetISearchStringW (BYVAL hwndLV AS DWORD) AS WSTRING
#Endif
Jose,
Thanks.
Is this because when FF generates the declares it does not deal with the conditional compile #IF block correctly?
Is there any way to easily work around the issue so I can use the TreeView control? Maybe cut/paste the individual functions I need without any conditional compile #IF (I don't need Unicode).
If this is the problem then any included code with conditional compiles won't work correctly in FF.
Mark
Quote from: Mark Strickland on November 11, 2013, 12:56:06 AM
Is this because when FF generates the declares it does not deal with the conditional compile #IF block correctly?
Yes, that is correct. FF does not parse the #IF directives when generating the DECLAREs for any functions within modules or forms in the project.
Quote
Is there any way to easily work around the issue so I can use the TreeView control? Maybe cut/paste the individual functions I need without any conditional compile #IF (I don't need Unicode).
Simply add a Treeview control at design time and FF will generate the necessary #Include statement, or you can manually add the #Include "TreeviewCtrl.inc" statement yourself to FF_AppStart.
Quote
If this is the problem then any included code with conditional compiles won't work correctly in FF.
Any conditional compiles that are subject to FF's parser will be affected. For example, function declares, TYPE/UNION definitions. If the code is attached to the project via an #INCLUDE then it is not touched. If it is part of a FF code module then it will be parsed unless explicitly excluded from parsing via "Project Properties", "Module Parsing". Using the exlude from module parsing approach will allow you to keep the TreeviewCtrl.inc file in your project as a module. Personally, I never have Jose's includes as project modules. I always #Include them.
Thanks.
And all of that makes sense .... apparently I just had never used any includes with conditional compiles added as a Module in FF.