AvailableTop is Negative?

I have my MacBook Pro sitting beneath my LG UltraFine, and the displays are arranged that way in System Preferences. The menu bar is on the MBP.

When I check the .AvailableTop property for the LG’s Screen, it equals -1440. I was expecting it to be zero, as there isn’t any menu bar on that screen.

The MBP is 777x800, the LG is 1440x2650. Both are Retina.

[code][code]dim s as integer
dim at as integer
dim ht as integer

for s=0 to screenCount-1

at=Screen(s.AvailableTop 'This is 23 for the MBP, -1440 for the LG
ht=Screen(s).Height '777 for the MBP, 1440 for the LG

next[/code][/code]

Why would AvailableTop be negative? I can’t find anything in the docs to explain this.

I think i may have found an answer here: https://stackoverflow.com/a/21826195

aren’t they relative to Screen(0)?

The docs don’t mention that, though it sounds like a possible explanation. I wish there was a picture somewhere in the docs that showed what each property actually was.

I have 3 monitors… horizontal layout… and AvailableLeft is relative to Screen 0

Screen 0 is 0
Screen 1 is -1280 (the width of Screen 0) and its on the far left
Screen 2 is +2560 (Screen 0 is 2560 wide)

[quote=397955:@Dave S]I have 3 monitors… horizontal layout… and AvailableLeft is relative to Screen 0
[/quote]

interesting! That means .AvailableTop and .AvailableLeft are useful for determining which windows are where in 2D space relative to screen(0). However, I thought that’s what .Top and .Left are for.

I believe Screen(0) will always be the monitor with the main menu bar in macOS. The Top and Left will be each monitor’s relative offset from Screen(0). While AvailableLeft and AvailableTop of each monitor excludes areas you can’t use (such as the menu bar area).

Try putting this code in a button, then move your monitors arangement or menu bar location:

		Dim s as String 
		for i as integer = 0 to ScreenCount -1
				s = s + "Screen " + str(i) + ": " + _
				Str(Screen(i).Width) + "x" + Str(Screen(i).Height) + _
				" @ " + _
				Str(Screen(i).Left) + "," + Str(Screen(i).Top) + _
				EndOfLine
		next
		MsgBox s

Modify if you also want to see Available… properties.

So a negative Top or Left means the monitor is positioned above or to the left of Screen(0).

Ah, so .Top and .Left refer to the outer edges of the window and .AvailableLeft and .AvailableTop refer to the useable content area. This makes sense, I do wish the LR would say it that clearly. I don’t know why I’ve been confused about this after using RB/Xojo for 10+ years. Must be the old-age genes kicking in…:slight_smile:

Thank you!

[quote=397962:@John McKernon]
Ah, so .Top and .Left refer to the outer edges of the window and .AvailableLeft and .AvailableTop refer to the useable content area. This makes sense, I do wish the LR would say it that clearly.[/quote]

Here is my LR description of AvailableLeft:

Here is my LR description of AvailableHeight:

While one can argue semantics and verbosity of a description, I think the above two samples convey the general idea that the difference in Available… properties is the usable area. But perhaps I have long understood this because I have used multiple monitors since before using RB then Xojo. And experimented with the numbers when developing routines to restore the last used window position and having trouble when restoring to a location which no longer exists. (I.E., an external monitor is no longer attached.)

Yes, these are clear. It’s AvailableTop that had me confused, because it was negative and there’s no mention in the LR of this. No doubt the info is in one of the user guides.

I think asking Paul to clarify things in the Language Reference is worthwhile. If you’ve had this question others will as well.

In my experience, a common problem with writing reference material is it often makes sense to somebody who already knows the answer. For example, the author. The trick is to get it to make sense to those coming to the reference material because they don’t already know the answer.

Is your Extanded view as follows:

[code]|---------------------|
| |
| | LG Monitor
| |

-------------------

[/code]

Douglas, I agree. That’s why many (most?) of my bug reports are from a newbie point of view. I don’t know and I don’t understand a lot of things about Xojo, so I hope that my experience learning could help make some changes to make Xojo more newbie friendly.

Yes, except that the MBP is a lot smaller than the LG.

So, how would you know where the monitors are if not like what you get ?

Reverse (in Monitors) the laptop monitor value (put it on top) and check the values; likewise, put both monitor “on the floor”, then reverse them (left / right) and check the values.

What you describe is standard behavior (on Mac OS, I neer tested on Windows).

This is extended display mode, excepted that you put the two monitors vertically (people usually set them horizontally).


The external monitor is on the top.


The external monitor is on the left.

Remember: as you can watch above, you can move the location of the monitors, thus the returned values.

Just move the Monitor rectangle to where you want. This dates from the first Macintosh II computer (the one with 6 NuBus slots !).

I only realized something now: the smaller monitor in the two screen shots above is 336 x 2100 while the largest is 1920 x 1080.

Go Figure !

That’s why it’s important to send in documentation update requests.