[futurebasic] Re: [FB] Problem AFTER loading PICT resources

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2001 : Group Archive : Group : All Groups

From: Alain Pastor <apastor@...>
Date: Wed, 04 Apr 2001 23:49:46 +0200

"Fast, Dennis" wrote:

>
>
> // This is in my ###.INCL file
> // This is part of a larger function that builds
> // the window and contains Next and Previous buttons.
>
> local fn ShowPic(PNum%)
>  dim ResNum%
>  ResNum% = 4000 + PNum%
>  kill picture gCurrentPict&
>  gCurrentPict& = 0
>  gCurrentPict& = FN GETRESOURCE(_"PICT",ResNum%)
>  picture field _picFld, &gCurrentPict&
> ' <snip...>
> end fn
>

Hello Dennis,

I don't know for the rest of the code, but here there is certainly a few
problems.
It seems to me that you are attempting to use Kill Picture on a resource
handle. This is a no no. You should use the ReleaseResource call in such a
case. Kill Picture is used with regular handles to picture.
You are attempting also to get rid of the picture handle while it is still in
use by the PICTURE FIELD. This is also a no no. I think you must change first
the picture in the field before disposing of the previous handle.
With the PICTURE FIELD statement you can use the ResID of your PICT resource
(with the % symbol in front of the ResID) or you can use a handle, in which
case I think you would have to detach the resource handle before putting it
into the PICTURE FIELD (with the & symbol), then you could use Kill Picture to
get rid of that handle later.
Using the ResID variant, the code would be simpler. You should make your PICT
resources purgeable when you save them (I'm not sure you would even have to
use ReleaseResource in that case)
--

Cheers

Alain

-----------------------------------------------------
FB^3 in Europe:  http://euro.futurebasic.com/
FB II Pouch:     http://www.pixmix.com/FB/outils.html
-----------------------------------------------------