Page 1 of 1

Location of stack

Posted: Sat May 15, 2010 5:02 pm
by pderocco
In my program, I write the location of my stack (among other things) to a text file on exit, and then read it and set the location on startup. This works correctly on Windows, but on the Mac, the window moves up by 12 pixels every time. This happens both when I run the .rev file or when I run my standalone. I use 'the location of stack "main"' to get and set the location. I'm using Rev 3.5. Is this a known bug?

Re: Location of stack

Posted: Mon May 17, 2010 1:44 pm
by Mark
Hi Paul,

The engine knows the actual height of the card only after loading all windows, objects, libraries etc. This is easy to solve, by first running all default startup messages (preOpenStack, openStack, preOpenCard, openCard, openBackground etc.) and changing the window size only afterwards. For example:

global gWindowRect

Code: Select all

on preOpenStack
  hide this stack
  readPrefs // your handler to read prefs
  send "setWindowSize" to me in 0 millisecs
  pass preOpenStack
end preOpenStack

on setWindowSize
  set the rect of this stack to gWindowRect
end setWindowSize
Instead of a handler that only sets the rect of the window, you could also write a handler that does the complete initialisation of your project. It is safe to assume that all necesary libraries are available when the initialisation handler runs.

I'm not sure that this is actually a bug, but it is definitely rather inconvenient. I think that the engine should be aware of the menu before it starts sending the startUp and other messages.

I'll post this answer to the Use List too.

Best regards,

Mark