Syntax
DlgLoadValues ValuesFile$, Identifier$
DlgLoadValues(ValuesFile$, Identifier$)
Remarks
On the Macintosh, the DlgLoadValues statement retrieves values stored by a DlgStoreValues instruction for controls in a custom dialog box.
Argument | Explanation | |
ValuesFile$ | The name of the file in which the values are stored. ValuesFile$ can include a path. If a path is not included, Word looks for ValuesFile$ in the Preferences folder. If ValuesFile$ does not exist, empty strings and null values are passed to the dialog box but no error occurs. | |
Identifier$ | A string that identifies the set of stored values (the same string is used when storing values with DlgStoreValues). |
The DlgLoadValues() behaves the same as the statement, and also returns the following values:
Value | Explanation | |
0 (zero) | If either ValuesFile$ or Identifier$ does not exist, or if any of the stored values cannot be loaded (this can occur if the dialog definition has changed since the values were last stored). | |
-1 | If the values were loaded successfully. |
In Windows, DlgLoadValues and DlgLoadValues() are not available and generate errors.
Example
This Macintosh macro shows how you can use DlgStoreValues and DlgLoadValues in a dialog function to save settings for a variety of dialog box controls. During initialization of the dialog box, the DlgLoadValues instruction runs; when the user chooses OK, the DlgStoreValues instruction runs. Note that the identifier for the first check box ends in 0 (zero), preventing Word from performing its default action of saving the check box setting. The first time the dialog box is displayed, the file containing the settings (DLGVALS) does not exist. The file is created the first time the DlgStoreValues instruction runs.
Sub MAIN Begin Dialog UserDialog 225, 167, "Test", .MyDlgFunction CheckBox 11, 48, 88, 19, "Test 1", .FirstBox0 CheckBox 97, 48, 88, 19, "Test 2", .SecondBox OKButton 118, 124, 88, 21 CancelButton 11, 124, 88, 21 TextBox 11, 24, 197, 18, .TextBox1 Text 11, 7, 46, 12, "Name:", .Text1 GroupBox 11, 71, 197, 41, "Group Box" OptionGroup .OptionGroup1 OptionButton 17, 84, 89, 18, "Option A", .OptionA OptionButton 110, 84, 89, 18, "Option B", .OptionB End Dialog Dim dlg As UserDialog DisableInput 1 button = Dialog(dlg) DisableInput 0 End Sub Function MyDlgFunction(identifier$, action, suppvalue) Select Case action Case 1 'initialization DlgLoadValues "DLGVALS", "MyDlgFunction" Case 2 'button chosen or setting changed If identifier$ = "OK" Then DlgStoreValues "DLGVALS", "MyDlgFunction" End If Case Else End Select End Function
See Also
DlgStoreValues