Page 1 of 1
[Done] Restoring last window position, size?
Posted: Wed Apr 03, 2013 2:11 pm
by Justin
How do you restore the last window position, size using the form editor?
The OpenWindow() procedure takes no parameters.
Re: Restoring last window position, size?
Posted: Wed Apr 03, 2013 8:05 pm
by Justin
Maybe the editor could use code like this?
Code: Select all
;Default values, the ones used at design time
#WindowX = 100
#WindowY = 200
#WindowWidth = 200
#Window_Height = 300
#WindowTitle = "title"
#WindowFlags = #PB_Window_SystemMenu
Procedure OpenMainWindow(x=#WindowY , y=#WindowY, width=#WindowWidth, height=#Window_Height , title$=#WindowTitle, flags=#WindowFlags)
MainWindow = OpenWindow(#PB_Any, x, y, width, height, title, flags)
EndProcedure
And when opening the window we could use the last ones saved in a preference file and using the default ones if not found
Code: Select all
x = ReadPreferenceLong("WindowX", #WindowX)
y = ReadPreferenceLong("WindowY", #WindowY)
...
...
OpenMainWindow(x, y, width, height, title, flags)
;If you don't need to restore
OpenMainWindow()
Re: Restoring last window position, size?
Posted: Thu Apr 11, 2013 4:49 pm
by Polo
For now, I changed the format to be like this:
Code: Select all
Procedure OpenWindow_0(x = 0, y = 0, width = 600, height = 400)
Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
...
The designer will be able to load files created with the old format.