Big SUR - APP Window top banner bar appears under the Apple Banner bar

Since I updated to Big SUR, when I open my APP, the APPs window top banner bar appears under the MACs Banner bar at the top of my MACs screen. I can just barely grab, with my mouse, the bottom of my APPs banner bar to drag it away. Once I have control of my apps window and move it around, it will not go back under the MAC banner, which is good.

Anyone experience this?
Jim

Screenshot? What is a “top banner bar”? Do you mean a menubar or a toolbar?

My APPs Title bar appears “under” the MACS menu bar.
Will try and get a screen shot

Notice my APP title bar is Under the Apple Menu bar

You can barely see the line for my Title bar - I have to click on this and drag my APP down

How do you set the position of your window? Does the window have a toolbar? Which version of Xojo do you use to make the app?

I had some delightful problems where windows with a toolbar moved up 100 pixels or so on each open in the early betas of BS.

2020 Release 2
It is my main “Window” title bar that is appearing under my Apps Menu Bar

But once I move the Window away from my Apps Menubar, it is ok, and the Window will not go under my Apps menu bar. Only on startup

How do you set the position of your window?

To expand on Beatrix’s question, make sure you understand the difference between a Window.Bounds and Window.Top/Left/Height/Width.

The .Top etc properties refer to the CONTENT region of the window, that is WITHOUT the title bar etc. While the .Bounds refers to the position WITH the title bar, frame, etc.

So if you are setting the .Top property to say 0 or something, the title bar is likely to end up under the menu bar. There is a blog article which nicely describes all of this but I didn’t find it quickly to reference here.

Also look at the example section of the Window.Bounds property docs, because it warns you can’t directly modify a Bounds property. See the docs for a more complete explanation why and what you can do.

Also, you may wish to make sure use something like Screen.AvailableTop to know where to place your window.

Ok
I added a messgagebox in my Window Open …“messagebox Form_HomeScreen.Top”
and it returned 50.
So I added a new line… “Form_HomeScreen.Top = 60”
And it works, my WindowTitle Bar is now just below the Menubar.
I guess the default is 50, I can’t see anyuwhere where I set TOP to 50.
Interesting Note: I have four of these apps on my MAC. All experienced the problem. I now fixed the one, rebuilt the executable, and its good. But now the other 3 are not having the orginal problem…

All, Thanks for your help.
Jim

What I was trying to say before is .Top is the wrong way to set the window position, as it does NOT include the title bar (if the window has one) or the frame, etc.

It is better to set the .Bounds property. And as @Jon_Ogden mentioned, you should look at the Screen object’s .AvailableTop property as it already adjusts for things like the menu bar or whatever.

Now if you were NOT previously setting the Window.Top property and you were letting Xojo place the window for you, then consider creating a Feedback case if something is acting different under Bug Sir.

But if looking for an immediate work around, consider using .Bounds and Screen.AvailableTop if you want to properly compute how to place the window title bar just below the menu (assuming the user has the menu visible).

1 Like

Doug is correct. You should technically not assume a title bar of 50 pixels (although I admit I do use that number on Windows). That could change in the future. I use this for OS X:

Me.Top = Self.GetScreen.AvailableTop+Self.TItleBarHeight
me.Left = self.GetScreen.AvailableLeft

GetScreen is a module method I have that gets the current screen the window is in.

Now what I always found odd is that the AvailableTop property is supposed to be what is available outside the title bar. I found it does not seem to work that way.

I am not sure about using the .Bounds property for setting top Top. I do use the .Bounds property of the window to make sure my width and height are within the available viewing area. Here’s a method I use:

Public Sub CheckWindowHeight(Extends MyWindow As Window)

  If MyWindow.Bounds.Height > MyWindow.GetScreen.AvailableHeight Then
    Dim r as New REALbasic.Rect
    r.Left = MyWindow.Bounds.Left
    r.Height = MyWindow.GetScreen.AvailableHeight
    r.Width = MyWindow.Bounds.Width
    r.top = MyWindow.GetScreen.AvailableTop
    MyWindow.Bounds = r
  End If
  
End Sub

And I see it do set the Top property of the window here with the bounds. It’s been a while since I’ve looked under the hood and figured out what code is running when. Whatever I have now does seem to work…

There was a Xojo Blog article about this, but I can’t find it quickly. The point is that Window.Top refers to the CONTENT area while Window.Bounds refers to the OUTER frame including title bar or whatever. The docs for Window.Bounds have an example of properly setting .Bounds as a rectangle instead of a single property within the Window.Bounds object itself.

If what you do is save the Window.Top/Left property and restore that on the next run, that also “mostly” works. Unless the screen resolution changes, the user changes the menu bar configuration, dock position (affects .Left/.Right more than .Top), etc.

2 Likes

Yes. Agreed! It took me a long time to figure that out. Window.Top is the top of the CONTENT not the actual frame of the window. Bounds is absolutely the right way to do it. Some of my settings where I’m using .Top occur earlier in my code execution and I then use .Bounds later on. It’s been years since I’ve messed with all that!

All
Thanks for your feedback. Based on your input I’ve gotten this to work quite well on my Window OPEN event

Form_HomeScreen.Bounds.Top = Screen(0).AvailableTop.ToString.ToDouble

Jim

Please replace with

Form_HomeScreen.Bounds.Top = Screen(0).AvailableTop

B
Thanks!
Jim