Hey all,
I’m wanting to smoothly unload and reload the same window (a bunch of stuff may have changed on this screen) so that any changes are displayed. What is the best way to do this? In this case, I tried:
mainscreen.close
mainscreen.show
Doesn’t work…just unloads the window and stops.
I tried using mainscreen.close in the window and then putting mainscreen.show in the Close event of the window, doesn’t work either.
I know about Invalidate…the project itself assigns new values to the stuff on the mainscreen window, and I want it to just unload and reload again to display the stuff that is loaded with the window opening at the start.
[quote]Window.Close method
Closes the window. Once closed, a window cannot be refreshed or redrawn.[/quote]
So you need to create a new instance or just don’t close the window.
[quote=114258:@Derek DiBenedetto]Hey all,
I’m wanting to smoothly unload and reload the same window (a bunch of stuff may have changed on this screen) so that any changes are displayed. What is the best way to do this? In this case, I tried:
mainscreen.close
mainscreen.show
Doesn’t work…just unloads the window and stops.
I tried using mainscreen.close in the window and then putting mainscreen.show in the Close event of the window, doesn’t work either.
![/quote]
dim newindow as mainscreen
mainscreen.close
Will create a clone of mainwindow and close the original. Now you have to make sure to set newindow.left and newwindow.top to the same as mainwindow so it appears to simply update.
Now this is not a very elegant way to update a window…
Thanks, Michel! I stumbled onto your solution by accident once I saw that windows are classes themselves. But I decided not to unload the window and just update the relevant controls and use window.Invalidate.