How do you restore the last window position, size using the form editor?
The OpenWindow() procedure takes no parameters.
[Done] Restoring last window position, size?
Re: Restoring last window position, size?
Maybe the editor could use code like this?
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
;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
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?
For now, I changed the format to be like this:
The designer will be able to load files created with the old format.
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)
...