changed: - This is also a good illustration of how to use the !PreferenceManager object. You simply define attributes of that object, and they are automagically added to it. In this example, we use **pm** as the name of the app's !PreferenceManager object, which has a path of **demo.prefdialog**, which is the app's !BasePrefKey. We then create keys off of it named 'fonts' and 'checkchanges' by simply referencing those keys as attributes of 'pm'. - - One cool thing about preference objects is that they can either persist their value as soon as you set it, or they can cache those changes until you either call their 'persist()' method (to save) or their 'cancel()' method to discard the changes. This behavior is controlled by the AutoPersist property of the preference object, but we don't have to worry about dealing with that here. Simply add any preference keys whose values you want to manage to the PreferenceDialog's **preferenceKeys** list, and their persistence settings will be handled for you. If the user cancels out of the dialog, none of the changes they made will be saved. This is also a good illustration of how to use the !PreferenceManager object. You simply define attributes of that object, and they are automagically added to it. In this example, we use **pm** as the name of the app's !PreferenceManager object, which has a path of **demo.PrefDialog**, which is the app's !BasePrefKey. We then create keys off of it named **fonts** and **checkChanges** by simply referencing those keys as attributes of **pm**. One cool thing about preference objects is that they can either persist their value as soon as you set it, or they can cache those changes until you either call their **persist()** method (to save) or their **cancel()** method to discard the changes. This behavior is controlled by the AutoPersist property of the preference object, but we don't have to worry about dealing with that here. Simply add any preference keys whose values you want to manage to the PreferenceDialog's **preferenceKeys** list, and their persistence settings will be handled for you. If the user cancels out of the dialog, none of the changes they made will be saved. changed: - Now that we have the preference information set, we call the **addCategory()** method to create the page for the font settings, passing in the caption "Fonts". This method adds the page to the dialog's paged control, and returns a reference to the newly-created page. We then use as the parent for the controls used for the font settings. To keep things simple, we have a single setting, called 'bold'. In a real app, you'd probably have default font faces, sizes, etc., but this will do for this demo. What's critical to note are the DataSource and DataField properties: DataSource is set to the **fontKey** object we defined, and DataField is set to 'bold'. This will automagically add the subkey of 'bold' to the fontKey preference object (if it doesn't already exist), making the full key path for this 'demo.prefdialog.fonts.bold'. Also, if there already is a setting saved for this key, it will be retrieved, and the control's Value will be set accordingly. We repeat this for the change management page, but this time we use a dropdown list to present the user with 3 options. This value will be saved to the preference database when the user clicks OK. Now that we have the preference information set, we call the **addCategory()** method to create the page for the font settings, passing in the caption "Fonts". This method adds the page to the dialog's paged control, and returns a reference to the newly-created page. We then use as the parent for the controls used for the font settings. To keep things simple, we have a single setting, called **bold**. In a real app, you'd probably have default font faces, sizes, etc., but this will do for this demo. What's critical to note are the DataSource and DataField properties: DataSource is set to the **fontKey** object we defined, and DataField is set to **bold**. This will automagically add the subkey of **bold** to the fontKey preference object (if it doesn't already exist), making the full key path for this **demo.prefDialog.fonts.bold**. Also, if there already is a setting saved for this key, it will be retrieved, and the control's Value will be set accordingly. We repeat this for the change management page, but this time we use a dropdown list to present the user with 3 options. This value will be saved to the preference database when the user clicks OK. changed: - - **!BasePrefKey**: This is the unique name under which your preferences are saved. For this demo I chose a subkey of 'prefdialog' off of a main 'demo' key. - **!BasePrefKey**: This is the unique name under which your preferences are saved. For this demo I chose a subkey of **prefDialog** off of a main **demo** key. changed: - - **!PreferenceDialogClass**: The class to display when the user selects the 'Preferences' menu item. In this example, it is the CustomPrefDlg class we defined. - - **!PreferenceDialogClass**: The class to display when the user selects the **Preferences** menu item. In this example, it is the **!CustomPrefDlg** class we defined.