[futurebasic] Re: [FB] Learning FB2 Toolbox - GWorlds

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2004 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Sun, 12 Sep 2004 08:25:22 -0400
On Sunday, September 12, 2004, at 08:22  AM, BrucesFB3@... wrote:

> Thanks Robert and Jay,
>
> I have tried each of your suggestions in turn and in various
> combinations. Every time I still get the same -50 error code.
> I don't know if it helps, but r,Rect = (0,10)-(322,0).
>

Yah, you are specifying that the bottom is less then the top...

Should be

Rect = (0,0)-(322,10)

Try SetRect(r,0,0,322,10)

r
c


> Any other ideas?
>
> Bruce
>
> The window created:
> WINDOW 1, "Drag Window",(0,0)-(400,300),_docNoGrow
> '------------------------------------------------------------------
> 'NOTE: the original program left out the rect param so
> 'it was default. Made no difference in results.
> '======================================
> clear local
> dim as rect r, patt, dragRect, tempRect
> dim as point dragPt
> dim as ptr gwPortPtr, stageGWPtr, iconGWPtr
> dim bkgrndGWPtr as CGrafPtr
> dim as handle gwDevH
> dim qdErr%
> '~'1
> local fn GWorldDragIcon(iconNum%)
> cursor _backArrowCursor
> tron break
> // Save current port and device settings
> '~'1
> getgworld(gwPortPtr,gwDevH)
>
> // Make the window background the first actor
> '~'1
> '========== The Crash =====================
> r = window(_wndPointer) + _portRect
> qdErr% = fn newgworld(bkgrndGWPtr,0,r,0,0,0)       '<---- qdErr = -50
> '=========================================
> long if qdErr != _noErr
> disposegworld(bkgrndGWPtr)
> end
> xelse
> '================================================
>
>
>> On Sat Sep 11 14:46:53 2004 BrucesFB3@... wrote
>>
>> Frank T's Learning FB2 Toolbox has a Demo on using
>> GWorlds. pp. 139-142.... crashes. I have traced the crash to
>> the lines below where    <<qdErr% = fn newgworld(bgGWPtr,(opt-L)
>> 0,#r,0,0,0)>>    produces an error of -50.
>
>>> On Sat Sep 11 17:20:04 2004 Robert Covington replied:
>
>>> Try something like...
>
>>> dim YourGWorld as Long
>>> or
>>> dim YourGWorld as CGrafPtr
>
>>> You don't need to be using #r unless it's a pointer.
>
>>> err = fn NewGWorld( YourGWorld, 32, SrcRect, 0, 0, 0 )
>
>>> You can use 0 for the depth though if you want the default depth of 
>>> the
>>> current port or screen.
>
>>> The usual cause of a failed gworld creation is a bad rect which leads
>>> to an out of memory error.
>
>>> I think a -50 is a bad param error though. Just try it with ' r ' 
>>> not '
>>> #r ' and otherwise DIM your GWorld not as a pointer but a long or
>>> CGrafPtr.
>
>>> I've dimmed Gworlds as longs for ages, and suffered no problems. But
>>> dimming something as a pointer explicitly can change how things 
>>> operate
>>> in a big way.
>
>>> Robert
>
> And On Sat Sep 11 18:27:25 2004 Jay Reeve replied:
>
>>>> Try sequentially   replacing #r with:
>>>> r
>>>> @r
>>>> #@r
>
>>>> I think one of them should help.
>
>>>> e-e
>>>> =J= a   y
>>>> "
>
>
> FreeGroups.net: Email Groups without advertisements.  Is your group 
> here?
>
> --
> To unsubscribe, send ANY message to: 
> futurebasic-unsubscribe@...