[futurebasic] Re: [FB] [FB^3] Obscure roach

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

From: Alain Pastor <apastor@...>
Date: Tue, 31 Jul 2001 17:24:15 +0200
Pete wrote:
> 
> I'm trying to track down a bug, in my FB^3 Clock program.
> 
> I've added an alarms feature, and now the clock window won't remember where
> it was on the screen between launches
> 
> Specs:
> FB^3 Release 5 - Rntm Ultralite.INCL
> (the prob was in release 4 as well)
> 
> When the app quits, it saves some prefs in a prefs file.
> 
> The prefs are stored as a resource.
> when the app launches, it opens the prefs file, gets the prefs rsrc then
> detaches the handle, closes the pref file's resource file, and then uses the
> handle when the apps needs to see how the user wants something done.
> 
> when the app is quiting, it gets the clock window's portrect, converts it to
> global coords:
> 
> /* Save the clock window's current location */
> gPrefsH..clockWndCoords = gClockWndPtr.portRect
> localtoglobal(gPrefsH..clockWndCoords)
> 
> This is the 3rd or 4th version of the code above
> 
> clockWndCoords is defined as:
> 
> begin record prefsRec/* Prefs record format */
> dim display12or24hourMode       as int
> dim clockWndCoords                   as point
> dim tallOrWideScreenMode         as int
> dim drawTheTextOnTheleftOrRight as int
> 
> dim dayColour  as rgbcolor
> dim niteColour as rgbcolor
> dim textColour as rgbcolor
> end record
> 
> dim gPrefsH as handle to prefsRec
> 
> I've put in debugging code to see what clockWndCoords is after, and there's
> some glitch, because after the LOCALTOGLOBAL clockWndCoords is still 0
> (zero) for both the h & v
> 
> Does anyone have a suggestion about what I'm doing wrong ?
> 
> The prefs handle appears to be ok, because none of the other prefs are
> damaged...
> 

Hi Pete,

Are the values correct before the localtoglobal call?

DEF DEBUGNUMBER(gPrefsH..clockWndCoords.v%)
DEF DEBUGNUMBER(gPrefsH..clockWndCoords.h%)

For the statement below:

gPrefsH..clockWndCoords = gClockWndPtr.portRect

How did you dim gClockWndPtr?

I'm surprised the Compiler let you do that without at least a warning.

the clockWndCoords field is defined as a point, you must then peek a
long integer. Perhaps doing like so:

gPrefsH..clockWndCoords = gClockWndPtr.portRect&

I think more code must be seen.


-- 

Cheers

Alain

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