I’m loading “default values” of an app and populating a window called “defaults”. The “defaults” window isnt visible unless you click a button and it pops up with values. These default values are loaded when you first run the program. The problem is, if I move the main window, the “defaults” window is right behind it. I dont want that visible. If I click the “defaults” button, it pops it up, I click the “ok” button I have defined which has a self.close. Once that happens, if I click on “defaults” button again, the values are no longer there. How do I get it to retain values? Is it a matter of how I’m approaching it? Should I load it all the time from the db (doesnt sound very efficient)…
If the “Implicit Instance” property is ON for the window, it will automatically be shown when you reference it in any way. You could turn that off and then create a new instance manually as needed.
Regardless, I’d probably load the defaults into a class (or module) and then have the window fetch the values from their in its Open event handler rather than directly setting the values of a window from your database lookup code.
If I disable that, then yes I have to come up with an alternative way to load “defaults” because if implicit isnt enabled, I cant pre-populate that window (error in my code).
When you say load defaults into a class or module…is there an example of that somewhere?
Alex, create a module (call it something like globalProperties) and create a property in it for each of the “default” properties. Then reference them in the defaultWindow open event to populate the defaults.
The quick and dirty solution it to set the defaults window’s Visible property to False in the IDE. But using a module/class/dictionary is a better solution.