How to position window at Top Left

Hello everyone,
How is it possible to position a window at the top left of the screen, or in the case of MDI at the top left below the menubar of the MDIWindow?
If we leave it by default, it appears to be somehow “stacked” and it keeps moving down and right every time a window opens!
Also it may be a document or dialog window, or it may be a plain box window…

Thank you all very much in advance…

dim barheight as integer = self.top-self.Bounds.Top dim frameleft as integer = self.Left-self.Bounds.Left self.top = screen(0).AvailableTop+barheight self.left = screen(0).AvailableLeft+frameleft

Barheight takes into account menu or not, modal or not (bar height is different), as well as toolBar.

Frameleft is accurate in Windows 7 and down, where the frame of the Document window is usually 8 pixels wide. In Windows 10, the frame is only one pixel, but since Xojo assumes an 8 pixels frame, you should subtract 7.

This works with any type window, including plain box.

This works for normal windows. I will have to look into MDI.

Thank you Michel.
In the case of usinbg MDI, the window top appears behind the menu title of the MDIWindow. Do you think there is a way to catch this?

best thing… don’t use MDI
its antique. outdated, even Microsoft reccomends it no longer be used.

So this might be a chance to start creating software that is more in line with current GUI criteria… and will also give you the ability (in the future, should you so choose) to create cross-platform software (ie. OSX/Linux done’t support MDI for the reasons above)

Thanks Dave for the suggestion, however in a specific case it is required!
However, even in this case there is no problem to keep the app cross-platform, since the MDI can only be set for windows.

[quote=211738:@FOTIS GEORGIADIS]Thank you Michel.
In the case of usinbg MDI, the window top appears behind the menu title of the MDIWindow. Do you think there is a way to catch this?[/quote]

You need to reference the MDI master window :

dim barheight as integer = self.top-self.Bounds.Top dim frameleft as integer = self.Left-self.Bounds.Left self.top = app.MDIWindow.Top+barheight self.left = app.MDIWindow.Left+frameleft

I concur with Dave on this one, though : MDI dates back to Windows 1 until Windows 3.2, when Microsoft was trying to have a different interface than Mac. Since Windows 95, MDI has shown it’s age. Today with the Modern UI design (Metro and Windows 10), it is downright prehistoric.

The trend in Windows is actually no window at all, but panes and sliding blocks, page oriented like a web app.

If you are to refactor an app, or start a brand new one, you may want to have a look at the latest Microsoft design guidelines : https://msdn.microsoft.com/library/windows/apps/hh465424.aspx

I find them quite inspiring. They give a fresh look to Windows apps that used to feel a bit old fashioned as compared to the most recent Mac apps.

Thanks Michel, I will try it.
The Microsoft design guidelines do seem good (from a first look).