[futurebasic] Re: [FB] Passing a rect to a function

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2003 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Sun, 26 Oct 2003 04:12:17 -0500
On Sunday, October 26, 2003, at 03:56  AM, Bernie Wylde wrote:

> I can pass a rect to a function and access its individual t,l,b,r 
> fields within the function. But, if my function contains say the 
> toolbox 'SectRect', I first need to copy the rect to another rect var 
> and then pass this to SectRect. Is there a way to avoid this?


Do you have to or nothing works, or you just do it as habit (like I do 
on occasion)? ' r ' is already a pointer, so I would think that

bool = fn SectRect (@testRect, r, @rIntersect)

...would work.

Otherwise, try

bool = fn SectRect (@testRect,#r, @rIntersect)

Otherwise, RP will say, no, that's wrong. :)

I don't even think I use @ with mine. FB seems to pointerize whatever 
the current need is automatically.

bool = fn SectRect (testRect,#r, rIntersect)
rc







>
>
> Example:
>
> clear local
> local fn CompareRect(r as ^rect)
> dim as rect    testRect, anotherRect, rIntersect
> dim as boolean bool
>
> anotherRect = r
> SetRect(testRect, 10, 10, 20, 30)
> bool = fn SectRect (@ testRect, @ anotherRect, @ rIntersect)
>
> long if bool
> //do some other things
> end if
>
> end fn = bool
>
> dim as rect    r
> dim as boolean intersect
>
> SetRect(r, 15, 10, 100, 200)
> intersect = fn CompareRect(r)
>
> if intersect then beep
>
>
> --
> To unsubscribe, send ANY message to 
> <futurebasic-unsubscribe@...>
>