Locate / set the location of a window

On OS X, a window cannot be set outside of the monitor area (I think so).

Yesterday evening and so earlier today, I was unable to see / display my main window (in a project, run in the IDE).

Note:
In that project, I store / restore the window position at quit / launch time. For hatever reason, my window last x,y values were outside of the MacBook Pro monitor area. After a simple search (earlier today, at awaken time), I had the (queer idea) to connect my external monitor… and found it there.

Is it normal or is there’s a bug to report ?

BTW: there is something in the IDE itself that does not follow Apple (applications / OS) usages about window positions (I can put the window title nearly all above the external monitor top value for example.

it’s simply possible and you can of course have your app move all windows into visible area after launch.

On MS Windows it is the same. for example, if you move your window on a bigger screen to the left side and store this position, the next time you open this window and set the stored position in a smaller screen or one with less resolution, you couldn’t see the window.

Thats quite normal. So it is in your responsibility to check if the window is in the visible area.

Of course the right side of the screen is meant

Thank you for your kind (as always) answer.

I fear someone gaves me that answer. I think it is a good answer since I am the programmer, I have to know what to do (recall what I’ve done !).

In that case - I store the window location at application quit time - I fall into a logic error (my logic). But as far as I think, I do not know what to do:

• the user can have two or more monitors and always have them connected,
• the user (like me) can have one (or many) connected monitor(s) that he connect or unconnect at will.

BTW: I may forgot to tell an important fact: the window location is the main window. If the user cannot see this window, all he have to do is to stop using it.

What to do ?

a. Store the location at quit time and check at launch time if the location is “withing the monitor(s) boundaries” and if not, set them to 0,0 ?

b. Warn the user at launch time that the MAIN WINDOW previous location is outside of the visibme monitor(s) area and ask him/her what to do ?

In the mean time, I may have to add a MenuItem to reset the window location to a visible x,y values.

What is your opinion ?

On Windows XP, this is always the case: the OS does not moves the windows to a visible part of the monitors (in the case where you do not set the window location at application launch).

I had a TNT TV Key software that does that.
(Worst, that software refuse to see the TNT USB hardware if it was not on the USB port you used at software installation… Weird, I had 5 USB ports on that PC Laptop !
So, it was easy to put the key here or there…

There was a version of Feedback that suffered this problem. I have a laptop that I use in the office with 2 monitors attached. I had Feedback on the left monitor (secondary) and when I unplugged the monitors to use the laptop away from the office Feedback would load on the unplugged in monitor. On Windows you can press + followed by M and then use the arrow keys to move the window into view (of course it helps to know which way to move the window :slight_smile: ).

In short it’s our problem to ensure the window is displayed in the visible area of the users screen.

set to 0/0 does not work well. Better not apply saved position to the window and use default position.

with 0/0 you hide the menubar.

ah and maybe you save a set with screen configuration (widths and height of screens) with your window size, so you can later lookup if screens match and put back windows on position.
Your users appreciate it if you remember window positions for Laptop and different position for Laptop + external Display.

Would you mind sharing exactly how you do that?

I’m brand new to Xojo, so still learning.

Thanks.

On Window.Close, get the Window.Bounds property and save it somewhere. For light use I prefer @Dave S’s INI module to save the data. (https://forum.xojo.com/8610-configuration-preferences-file/10)

Note that Windows.Bounds includes the frame, titlebar, etc. Use iWndow.Height, .Width, .Left and .Top for just the window size itself.

Edit:

Don’t forget to restore the size in Window.Open.

[quote=96326:@Christian Schmitz]ah and maybe you save a set with screen configuration (widths and height of screens) with your window size, so you can later lookup if screens match and put back windows on position.
Your users appreciate it if you remember window positions for Laptop and different position for Laptop + external Display.[/quote]

Wow Christian, That’s really clever.
In my video editing system of choice (Premiere Pro) I have to assign several workspace layouts to match the environment I work in.

I have a couple of multi-window layout apps that basically do the same. But the screen configuration trick is way more user friendly.