[futurebasic] [FB3] Region saving

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2002 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Fri, 24 May 2002 00:59:13 -0400
I need to be able to save the contents of a Region handle for reloading later.


The below demo shows that it works, however I am wondering what if any
pitfalls lurk, or if loading a regionhandle without benefit of FN NewRGN to
init it first will work fine?

Actually, commenting out all but the reload (if the file already exists)
and loading it works fine without NewRGN.

Just wondering.

rc

Begin Globals
DIM gRegionH as Rgnhandle
end globals



Local FN makeRegion
DIM r as rect
setRect(r,40,40,230,230)
gRegionH = 0
gRegionH = FN NewRgn
long if gRegionH
RectRgn(gRegionH,r)
end if

end fn


Window 1

FN MakeRegion

if gRegionH <> 0 then FrameRgn(gRegionH)

Open "R",1,"RegionList",,system(_aplVol)
WRITE FIELD #1, gRegionH
Close #1


do
until FN Button
FlushEvents

cls
if gRegionH then disposeRGN(gRegionH): gRegionH = 0
delay 1500

Open "I",1,"RegionList",,system(_aplVol)
Read FIELD #1, gRegionH
Close #1
if gRegionH <> 0 then FrameRgn(gRegionH)

do
until FN Button

if gRegionH then disposeRGN(gRegionH)