Posting this here as it may be useful to some people; I spent an hour tracking down a bug caused by it. The menu bar (containing the Apple menu, application menu, plus File, Edit etc.) at the top of the screen is 23px high in Yosemite. It’s 22px high in Mavericks. If you rely on that number for positioning you’ll need to edit your apps.
That’s why you should always use Screen(0).AvailableTop instead of hard-coding a number.
Yep, which we do everywhere… apart from in one place, because I am an idiot…
Hey, someone else like me. =) Thanks Thom for pointing that out, it’s probably hardcoded in my code somewhere, enmeshed in something else.
You are in good company. It happens to all of us at some point.
MSGBox "Screen(0).AvailableTop = " + str(Screen(0).AvailableTop)
shows me: Screen(0).AvailableTop = 22
Window1.Top = Screen(0).AvailableTop
sets the window top to position 0
is this normal?
[quote=122289:@Axel Schneider]MSGBox "Screen(0).AvailableTop = " + str(Screen(0).AvailableTop)
shows me: Screen(0).AvailableTop = 22
Window1.Top = Screen(0).AvailableTop
sets the window top to position 0
is this normal?
[/quote]
Looks very much like a bug …
here is the example that I have used.
It’s not a bug; Window.Top places the top of the window’s content area at the specified coordinate. Window.Bounds can be used to control the overall position.
Window.Bounds: added in Real Studio 2012r1 (2012-08-21).
I do not memorize it (and that is why I searched when it was added )
Thank you for the reminder Joe.
Gosh. I have been using window.top for the longest time believing it was the top bound !
Thank you for clarifying, Joe
Thank you!
To place the window directly below the menu bar
Dim myBounds As New Realbasic.Rect
myBounds.Width = 400 // your Window Width
myBounds.Height = 300 // your Window Height
myBounds.Left = Screen(0).AvailableWidth / 2 - Window1.Width/2 // your Window Left
myBounds.Top = 0 + Screen(0).AvailableTop
Window1.Bounds = myBounds
that works too
Window1.Top = Screen(0).AvailableTop * 2
[quote=122560:@Axel Schneider]that works too
Window1.Top = Screen(0).AvailableTop * 2
[/quote]
Will not work on Yosemite, where the menu bar is 23 pixels instead of 22.
https://forum.xojo.com/14954-menu-bar-1px-taller-in-yosemite-than-mavericks
Does not work for a Floating window which has a 17 pixels bar.
Not cross platform, since Windows window bar is not 22 pixels.
The method you posted with Bounds is the best.
[quote=122570:@Michel Bujardet]Will not work on Yosemite, where the menu bar is 23 pixels instead of 22.
https://forum.xojo.com/14954-menu-bar-1px-taller-in-yosemite-than-mavericks
Does not work for a Floating window which has a 17 pixels bar.
Not cross platform, since Windows window bar is not 22 pixels.
The method you posted with Bounds is the best.[/quote]
Oh look… Recursive links!
Right. Endless loop mind. Bad :s