Using a prefernce/options form
Posted on 2004-08-30
Can someone explain how and where a person is suppose to put the code to save & load settings for an application if you use a settings form?
A standard settings form would have an "OK" | "Apply" | "Cancel" buttons on it.
Now obviously when a user selects "OK" the settings are saved and the settings form is closed. No Prob.
And when a User "Cancels", no settings are saved and the old settings should be reloaded and then the settings form is closed. No Prob.
"Apply" is the same as "OK" except no settings are saved.
Now the problem I have, is when and where do I load the settings when my application is started!
When I load the settings at startup, I cant set any of the components in my settings form unless my settings form is visible.
I thought all forms are created right away when an app is created?
Shouldnt you be able to change things on a form even if its hidden?
Am I doing this wrong? Should I load the settings into a global variable and then set the component on my settings form when it is shown?
And not use the components to directly access the settings? I mean, if I want to know if my app is suppose to startup to the tray, should I see if a certain checkbox is checked in the settings form, or should I use a global var? I want to use ReadComponent/WriteComponent to load & save my settings, or should I just use a simple ini?