[futurebasic] Re: [FB] FB^3 Passing POINT &/or RECT vars.

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

From: Robert Purves <robert.purves@...>
Date: Mon, 21 Feb 2000 11:04:15 +1300
>The compiler gives an unknown variable type error when I try to define the
>functions like any of these: (I had hoped the first two would be
>acceptable.)
>    LOCAL FN ConnectPoints( ptA AS POINT, ptB AS POINT)
> or LOCAL FN FlashRect( aRect AS RECT )
> or LOCAL FN FlashRect( aRect AS POINTER TO RECT )

FN FlashRect works OK as shown below. FN ConnectPoints doesn't work with
the release version of FB (3.1.4) because POINT variables weren't
implemented properly. They _do_ work in a recent beta version. Presumably
in the next release you will be able to use the code that is commented out
in the example below.

I agree that writing FN FlashRect(myRect(0)) is an ugly workaround, which
invites the wrong interpretation:   a RECT is a record, not an array.

Robert P.

end globals
local fn FlashRect(aRect AS POINTER TO RECT)
call invertrect(#aRect)
delay 250
call invertrect(#aRect)
end fn
/* not accepted by FB3.1.4, but OK in recent beta version
local fn ConnectPoints(ptA AS POINT, ptB AS POINT)
call moveto(ptA.h%, ptA.v%)
call lineto(ptB.h%, ptB.v%)
end fn
*/
dim myRect as rect, myPoint1 as point, myPoint2 as point
window 1
menu 1,0,1,"File"
menu 1,1,1,"Quit/Q"
call setrect(myRect,10,10,100,100)
FN FlashRect(myRect)    // or FN FlashRect(@myRect)

call setpt(myPoint1, 10,10)
call setpt(myPoint2, 100,100)
//FN ConnectPoints(myPoint1, myPoint2)
do
handleevents
until fn button