Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Creating Tools > Options window

Creating Tools > Options window

Scheduled Pinned Locked Moved C#
toolsquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    student_rhr
    wrote on last edited by
    #1

    I am strugling with creating an Options Window (like how you go to Tools > Options and a window pops up with options in it). Does any one know of a way to create this type of windows? Any Ideas, link to an article / white paper etc will be highly appreciated. Thanks.

    P B 2 Replies Last reply
    0
    • S student_rhr

      I am strugling with creating an Options Window (like how you go to Tools > Options and a window pops up with options in it). Does any one know of a way to create this type of windows? Any Ideas, link to an article / white paper etc will be highly appreciated. Thanks.

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      Just create a new form with the options, and from your main form button/menu item click/whatever, call it up. Nothing much really to it.

      "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

      1 Reply Last reply
      0
      • S student_rhr

        I am strugling with creating an Options Window (like how you go to Tools > Options and a window pops up with options in it). Does any one know of a way to create this type of windows? Any Ideas, link to an article / white paper etc will be highly appreciated. Thanks.

        B Offline
        B Offline
        BoneSoft
        wrote on last edited by
        #3

        The window's not hard, you do that like any other window. What you need to decide is what all you will show, how you will store choices, and how the rest of you app reads and responds to those choices. I assume that's what you're talking about. I don't know of an article specificly dealing with that, though many may have something like that built into articles about other topics. Personally, I'd use XML serialization: decide what options to offer, build an XML structure to house them, make your options form address those options, read your config, and write to it. Then I'd probably have the host form show it as a dialog [optwin.ShowDialog()], and make it expose your XML serializable config object as a property so that the host can get the options directly from the options form. And make your host form look for the config on load to initially respond to saved options. But there are a number of things to consider and work out with this. Clear as mud?


        Try code model generation tools at BoneSoft.com.

        S 1 Reply Last reply
        0
        • B BoneSoft

          The window's not hard, you do that like any other window. What you need to decide is what all you will show, how you will store choices, and how the rest of you app reads and responds to those choices. I assume that's what you're talking about. I don't know of an article specificly dealing with that, though many may have something like that built into articles about other topics. Personally, I'd use XML serialization: decide what options to offer, build an XML structure to house them, make your options form address those options, read your config, and write to it. Then I'd probably have the host form show it as a dialog [optwin.ShowDialog()], and make it expose your XML serializable config object as a property so that the host can get the options directly from the options form. And make your host form look for the config on load to initially respond to saved options. But there are a number of things to consider and work out with this. Clear as mud?


          Try code model generation tools at BoneSoft.com.

          S Offline
          S Offline
          student_rhr
          wrote on last edited by
          #4

          The window's not hard, you do that like any other window. What you need to decide is what
          all you will show, how you will store choices, and how the rest of you app reads and responds to
          those choices. I assume that's what you're talking about.

          Yes I am.

          Clear as mud?

          :) pretty much!! I have the settings for my applications stored in the MyApp.settings file. Would that be a bad idea? Also, when the settings are changed i.e. user has changed some stuff in the options window, the parent form doesn't autmatically apply the changes. For it to apply changes does it have to be "refreshed" or "reloaded"?

          B 1 Reply Last reply
          0
          • S student_rhr

            The window's not hard, you do that like any other window. What you need to decide is what
            all you will show, how you will store choices, and how the rest of you app reads and responds to
            those choices. I assume that's what you're talking about.

            Yes I am.

            Clear as mud?

            :) pretty much!! I have the settings for my applications stored in the MyApp.settings file. Would that be a bad idea? Also, when the settings are changed i.e. user has changed some stuff in the options window, the parent form doesn't autmatically apply the changes. For it to apply changes does it have to be "refreshed" or "reloaded"?

            B Offline
            B Offline
            BoneSoft
            wrote on last edited by
            #5

            There's nothing wrong with using app.settings. For the app to take advantage of setting changes, you can have the host form get the settings from the options form before it is disposed, or read them from your app.settings file after the options form is closed.

            private void ChangeSettings() {
            MyOptionsForm mof = new MyOptionsForm();
            // show your settings form as a dialog
            // this line will show the form, and get the result when it closes
            // but you still have the mof reference to it, and can access it's
            // public properties.
            if (mof.ShowDialog() == DialogResult.OK) {
            // Make Setting Changes Here
            // Expose setting properties from MyOptionsForm
            // or re-read your settings file here.
            }
            }

            That help?


            Try code model generation tools at BoneSoft.com.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups