Problem with Function changed to Macro

Started by John Montenigro, October 22, 2006, 07:48:40 PM

Previous topic - Next topic

John Montenigro


Macro DisplayValuesList (arrayname,membername,listboxname,EndOn)
'
'arrayname would be called as either:     gRank1        or   gFinal
'membername would be called as either:    nSeq1stRank   or   nSeqFinal
'listboxname would be calles as either:   HWND_FRMINPUT_LST1STRANKING    or   HWND_FRMINPUT_LSTFINAL
                                                                 

'    Local x As Long, i As Long, lRet As Long
'    Local nIndex As Long 'normal index for finding  

MacroTemp x,i,lRet,nIndex,UniqueValueCount
Dim x As Long, i As Long, lRet As Long, nIndex As Long, UniqueValueCount As Long


   'now clear the Values listbox
'    FF_ListBox_ResetContent HWND_FRMINPUT_LST1STRANKING    'listboxname
   FF_ListBox_ResetContent listboxname



I converted a Function that was working perfectly into a Macro so that I can pass it different arrays of UDTs, specifiying various membernames for internal use.

The Macro name is different from the old Function name, and I edited everything to use the macro. It all works fine.

Now that I don't need the Function anymore, I commented it out, and suddenly FF complains:

Error 519: Missing Declaration: FF_LISTBOX_RESETCONTENT
DisplayValuesList(gRank1,nSeq1stRank,HWND_FRMINPUT_LST1STRANKING,0)



This is the only FF call made within the macro.

Why does it work OK when the old function (even though it is not being called) is not commented out, but complains when it is commented out?


Un-comment the function and we're good again.

-John

==================
after more testing, even stranger:

Surrounded the old function with #IF 0 / #ENDIF
and it compiled without complaint!  

????

TechSupport

I have absolutely no idea.... :D

This would be one of those cases where the only way that I will be able to find and answer is to examine your source code (or a sample that demonstrates the problem).

Sean Roe

My guess would be that since Macro is a substitution at compile time, then where this is getting called is before the definition for the firefly function. Have you attempted to replace the firefly function code for just a plain api call to reset the listbox?

Please let me know what you find.

Thanks.

John Montenigro

Since posting this, I went back to discrete FUNCTIONs, one for each UDT.

Now that its all working, I'm going to try generalizing everything to a new set of MACROs. I'm going to ignore my original MACRO definitions and write fresh.

I'll keep you posted.

Sean, I thought about that - what FF sees first... Ususally I define my MACROs right up front in the main form, but this time I interspersed the macro definitions near the FUNCTION I was converting. I'll try moving it around to see if position makes a difference.

Paul, let me play with it today, and if it's still happening, I'll let you know. Then we can arrange for delivery of a .zipfile for your examination.

-John

Sean Roe

I don't think it matters where the macro definition is since this is a compile time expansion and replacement which is why you can forward reference from one macro to another.

Yes please keep me posted since I am really beginning to dig into macro usage.