[Done] Restoring last window position, size?

You need some new stunning features ? Tell us here.
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

[Done] Restoring last window position, size?

Post by Justin »

How do you restore the last window position, size using the form editor?
The OpenWindow() procedure takes no parameters.
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Re: Restoring last window position, size?

Post 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()
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Restoring last window position, size?

Post 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.
Post Reply