CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Settings Dialog

  1. #1
    Join Date
    May 2004
    Posts
    72

    Settings Dialog

    Just because of curiosity, what is the best way to do a settings dialog?

    Currently, I just use this:
    Have an ini file to store settings.
    On load, read the settings and store them in variables.
    Settings dialog accessed via a menu.
    Settings dialog used via DoModal
    Settings dialog reads ini and stores settings in variables.
    If "ok" is clicked, validate and save new settings to ini.
    If DoModal returned "ok" button's ID, read ini and update variables.

    This works fine, but something tells me there's a much better way to do this.
    Any comments, suggestions would be helpful and appreciated

    Thanks.

  2. #2
    Join Date
    Jun 2007
    Posts
    29

    Re: Settings Dialog

    Settings dialog reads ini and stores settings in variables.
    That's the only real part I would take issue with. There should be a settings object or something that stores these variables while the program is running. Are you reading the ini file every time a variable is needed?

  3. #3
    Join Date
    Apr 1999
    Posts
    3,585

    Re: Settings Dialog

    Regardless of how you implement it, you still have the same basic scenario. You have some external data that needs to update some program variables. The real issue is whether you want the external data easily accessible to the user. Some of the scenarios that others have used include the following:

    1. Save to an archive file.
    2. Use the registry API to store settings.

    #2 seems to be the prevalent way of doing this, however, whatever suits your needs the best should be used.
    Gort...Klaatu, Barada Nikto!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured