windows - create all and hide or create on the fly

BlitzMax Forums/BlitzMax Beginners Area/windows - create all and hide or create on the fly

Amon(Posted 2005) [#1]
If I have windows that would appear when a menu action is performed, is it best to create the window with all it's components on the fly or to pre create the window, hide it then activate it when needed?

Just looking for the best method. I also want to avoid instances where on some machines all pre created windows which are hidden show up anyway regardless if it's coded not to. I've seen this happen for Halo and 3DWS.

Thanks :)


CoderLaureate(Posted 2006) [#2]
I would think that creating them as needed would be better on system resources. But perhaps there're some BMax gurus out there with a different opinion.


taxlerendiosk(Posted 2006) [#3]
Well, currently (in Win32) if you create a canvas and free it, the graphics context assigned to it is not freed. So, if you repeatedly open and close a window that has a canvas using the create/destroy method, memory consumption will rise and rise. Posted a bug report about this in the relevant forum a couple of days ago, but there's been no official response about it yet (understandably, I know).

If that's fixed, definitely go with create/destroy, I think.