I have a movable Modal window (InputWindow) that I would like to save its position when it closes. However, when I reopen it, it keeps coming up in the center of the screen. (Windows 8.1, Xojo R2.1)
I do not have this behaviour when the window is a document.
Notes:
- The window is not opened by using Show, ShowModal or any of them. I have a Method called LoadFields() that creates controls and shows the window.
In Mainwindow:
InputWindow.LoadFields(MyGrid,tmpLayout.PossibleChildLayouts(0), 0)
- In a module I have variables to hold the position (InputLeft=0, InputTop=0, InputFirstTime=true)
In InputWindow Open() event:
if not InputFirstTime then
self.Left = InputLeft
self.Top = InputTop
end if
InputFirstTime = False
In inputWindow Close() event:
InputLeft = self.Left
InputTop = self.Top
When I set breaks in the code, the values of InputLeft and InputTop are correct, and in the open() event the InputFirstTime condition does what it has to do. The values of self.top and self.left are even set to the new position. But once the window pops up, it pops up at its default position (center), ignoring the changes I made.
As said, as a Document window, the behaviour is correct using the InputLeft, InputTop variables.