On Dec 8, 2010, at 2:44 PM, Real Basic wrote:
> I did, or at least I thought I did. But then I get "Invalid use of
> incomplete type 'struct REALobjectStruct'. But I have since gotten
> over that hurdle.
>
> Everything now compiles, but I have no idea how to use it. The sample
> code looks like this:
>
> void (*fpConnect)( REALobject ) = NULL;
> fpConnect = (void (*)( REALobject ))REALLoadObjectMethod( obj, "Connect()" );
> if (fpConnect) fpConnect( obj );
>
> and my code looks like this:
>
> void (*fpConnect)(REALobject) = NULL;
> fpConnect = (void
> (*)(REALobject))REALLoadObjectMethod((REALobjectStruct*)context,"DrawString(str
> as string, x as integer, y as integer)");
> if (fpConnect) fpConnect((REALobjectStruct*)context);
>
> How do I use my text and x,y values in conjunction with my fpConnect
> object? The "connect" sample doesn't show how to pass values in.
>
> --Seth
>
void graphics_DrawString(REALgraphics graphics, REALstring s, int x, int y, int
width, Boolean condense)
{
static void (*_fp)(REALgraphics, REALstring, int, int, int, Boolean) =
nil;
if (!_fp)
_fp = (void(*)(REALgraphics, REALstring, int, int, int,
Boolean))REALLoadObjectMethod((REALobject)graphics,"DrawString(s as string, x
as integer, y as Integer, w as integer, c as boolean)");
if (_fp)
_fp(graphics, s,x,y,width,condense);
}
Always lookup the signature in the language reference. If the signature is
incorrect then the function pointer _fp will always be NULL. The signature of
the graphics.DrawString is:
"DrawString(s as string, x as integer, y as Integer, w as integer, c as
boolean)"
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>