strange behavior by macros

Started by Christian Weilguny, November 14, 2012, 03:03:07 PM

Previous topic - Next topic

Christian Weilguny

Hi,

this time I had a very strange expirience relating to macros

In my code is at the top of a modul this macro defined:

Macro CurRec = oRecs(GetWindowLong(hWnd,%BrowserRec))

where

oRecs is an array of objects that are representig Recordsets (this is a class created by myself)
hWnd is the handle of the current custom control
%BrowserRec is the index in the cbWndExtra where the index in the array of the Recordset for this Control is stored.

This macro works very fine, mostly.
I can use this macro like an object: CurRec.Update, CurRec.AbsolutePosition, etc.
Suddenly one of the terms, which worked without problems, makes an error: error 530 invalid member name/definition.
If I compile the generated ..main.bas no error occurs.
If I move the line producing the error two lines down, the error is: error 477 syntax error.
If I write the code in place of the macro, no error occurs.

For completeness:
The code CurRec.Update makes the error, three lines down in the same Function the code CurRec.AbsolutePosition makes no error and the CurRec.Update makes another error (477).
The code oRecs(GetWindowLong(hWnd,%BrowserRec)).Update makes no error and the code CurRec.Update, compiled from the generated main.bas in the PB-Ide makes no error, too.

Perhaps, someone can help me with this strange behavior?

Christian

Paul Squires

To be perfectly honest, I really don't know. Very strange problem. It is even stranger that compiling the main.bas does not generate an error.

I am puzzled.
Paul Squires
PlanetSquires Software