[futurebasic] FB^3 Rect Params

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : February 2000 : Group Archive : Group : All Groups

From: scram@... (Stu Cram)
Date: Sun, 20 Feb 2000 07:34:33 -0700
Thanks Mark for the tip on using a RECT as a function's parameter.

I had forgotten about the #ptr& method myself.
Now I know 2 ways to do this (in FB^3).

---------------------------------------
Method 1:  (FB II & FB^3)
    LOCAL FN FlashRect( rectPtr& )
        CALL InvertRect( #rectPtr& )
        DELAY 17
        CALL INVERTRECT( #rectPtr& )
    END FN

Call it like this:
    FN FlashRect(@myRect)
--------------------------------------
Method 2:  (FB^3 only)
    LOCAL FN FlashRect( rec(0) )
        CALL InvertRect( rec(0) )
        DELAY 17
        CALL INVERTRECT( rec(0) )
    END FN

Call it like this:
    FN FlashRect(myRect)
-------------------------------------

I tend to favour the 2nd way as the calling program
uses a rectangle's name directly. No extra @ to add.
This would be easier for beginners to do and remember,
especially if the 'flashRect' function and others
were elsewhere (ie. an Include file or library.)

What I hope to see in FB^3 is being able to use RECT and
POINT types as parameters in the function definition. If
arrays and records can be easily passed, why not these?

Anyways, thanks again Mark from another Canuck.
Stu Cram, Regina, SK CAN.