pbsw-code.net : pbsw-WindowSaver

pbsw-WindowSaver

A module with extensions to the Window class for saving/restoring the state of all its controls.

(Includes EditFields, RadioButtons, CheckBoxes, PopupMenus, ComboBoxes, ListBoxes, Sliders, BevelButtons (toggle style))

Requirements:

Operation Details:

A property list (plist) is created with the control names and the data they contain. The control name is used as the "key" for retrieval from the property list. (For more information on the pbsw-PropertyList package - see: http://pbsw-code.net/code/realbasic/classes/pbsw-PropertyList/

For control arrays, the control name has ".n" appended at the end, where "n" is the index of the array.

EditFields

The text of the field is stored.

CheckBoxes

A boolean property describing its state is stored.

RadioButtons

If no control array is used, then each radio button is stored with a "true" or "false" boolean property describing its state. If the radio buttons are in a control array, then the name of the array is used to store an integer property - indicating which radio button is selected.

PopupMenus

The text of the current selection is stored.

ComboBoxes

The text of the field is stored.

ListBoxes

An array property stores the rows (one entry per row). Each entry in the array of rows is an array property with one entry per column. If the cell has a check box in it, then its entry will be an array storing the cell text and a boolean value for the checkbox. Otherwise the entry will just be a string property with the cell text.

Sliders

The value of the slider is stored as an integer property.

BevelButtons (toggle style)

A boolean property describing its state is stored.


Module: pbsw_WindowSaver
This module holds the methods that extend the Window class and do the work.


Methods
CreatePlist(extends theWindow as Window, skipControls as string = "") as pbsw_PropertyList [Global]
Creates and returns a pbsw_PropertyList holding the information for all of the controls in theWindow.
skipControls is a comma separated list of names of controls NOT to save
SetControlsFromPlist(extends theWindow as Window, thePlist as pbsw_PropertyList) as boolean [Global]
Sets the values of the controls in theWindow from values stored in thePlist.
Returns true if everything went exactly as expected


pbsw-code.net : pbsw-WindowSaver