Step 3: Configuration Panels
Last updated on: 2/5/2013 10:29 PM
Created on: 11/2/2016 2:22 PM
The System Core 7 framework provides an area where the user can access setting dialogs to adjust customizable values. A great deal of work is performed by the framework to maintain settings including the file I/O, configuring to Administrator specifications and providing consistent means for applet programmers to access the information. Because much of the work is done behind the scenes there are only two classes that need to be considered to provide access to the configuration panel.
Applets must first subclass the ISCConfigPanelExtension interface. This interface only exposes three pure virtual methods which must be implemented. First, as is standard with many of the interfaces, is EnumPanelItem(). The framework will pass in an enumeration index starting with 0. For each enumeration the CONFIGPANELID structure must have the caption, icon and description parameters set. As long as there are panel items the framework needs to enumerate, return true from this method. The framework stops enumeration the first time this method returns false. It is important to keep track of the enumeration index as this value will be used when the framework needs to create or destroy the associated configuration panel dialog.
The CreatePanelDialog() method is invoked by the framework when the user selects a configuration panel that was previously enumerated. The CONFIGPANELID structure passed in as a parameter will contain the enumeration value that the user selected. Use this value to determine which dialog should be displayed. This method needs to then construct the dialog which must be subclassed from SCSettingsComplyDialog, then return a pointer to this dialog. Create the instance of the dialog using the new operatior, do not create the dialog on the stack. Also, do not maintain a pointer to the dialog as the pointer returned from this function will be maintained by the framework and passed as a parameter to the DestroyPanelDialog() method.
The SCSettingsCompyDialog is constructed with the setting that contains the values that will be modified by the user interface. In addition, this dialog contains a number of methods that allow an attribute value to be associated with a common UI control such as a drop down, spinbox or text edit control. The dialog also contains built in event logging to create a log event for the new settings should the user select the OK button of the dialog. Consult the documentation for this class to study how your applet settings can be presenting using this handy framework provided class. Also note that it is intented that one configuration panel dialog maintain the values associated with the keys under one setting. While multiple settings can be implemented within the dialog using the special virtual methods, it is preferred that multiple configuration panel dialogs be used to provide a simple interface to the end user.
The final method that needs to be implemented is the DestoryPanelDialog() method. The framework calls this everytime a dialog returned by the CreatePanelDialog() method is being closed. The parameters to this method include the enumeration index (stored in the CONFIGPANELID structure) from the EnumPanelItem() method for easy tracking. In addition to this parameter is the pointer to the SCSettingsComplyDialog based dialog class that is being freed and a boolean value to let the applet know if the user accepted changes or canceled the dialog. The framework no longer is tracking the memory for this dialog and it is recommended that the dialog resources be freed using the delete operator.
Now our Demo Applet can display configuration panel items in the configuration panel and create and destroy their associated panel dialogs.
Topics
Developer's Historical Persepctive Why A Platform Standards The User ExperienceInterfaces
ISCApplet ISCTaskListExtension ISCConfigPanelExtension ISCErrorReporterExtension ISCLogConnector/ISCLogEntry ISCCertificateStoreExtension ISCSystemTrayExtension ISCAppletWindowExtension ISCSecureObjectExtensionApplet Building Steps
Step 1: Create The Applet Step 2: Adding Action Items Step 3: Adding Configuration Panels Step 4: Adding Custom Error Text Step 5: Startup/Shutdown Step 6: Adding Main Window Support Step 7: Adding Obejct Window Support