System.Gadget.Settings.read Method
Retrieves a stored value of unspecified type associated with a gadget Settings key.
Syntax
= System.Gadget.Settings.read(
strName
)
Parameters
- strName [in]
BSTR String that specifies the name of the Settings key. - **
VARIANT The value of the Settings key. The datatype of the returned value will default to String if it cannot be coerced into one of the following: Boolean, Floating-point, Floating-point, or Integer.
Return Value
This method does not return a value.
Remarks
Use readString for performance and efficiency reasons if the datatype is a String.
There is a 1024 character limit for Settings keys and a 2048 character limit for Settings values; values longer than these limits will be truncated.
Use write or writeString to store Settings values.
The Settings values are unique for each user account, even if the same gadget is used.
Examples
The following example demonstrates how to retrieve a Settings value into a gadget variable.
// --------------------------------------------------------------------
// Handle the Settings dialog closed event.
// event = Event argument.
// --------------------------------------------------------------------
function SettingsClosed(event)
{
// User hit OK on the settings page.
if (event.closeAction == event.Action.commit)
{
userEntry =
System.Gadget.Settings.read("settingsSelectionIndex");
// Update gadget UI based on user Settings selection.
UpdateSelection(selectionIndex);
}
// User hit Cancel on the settings page.
else if (event.closeAction == event.Action.cancel)
{
SetContentText("Cancelled");
}
}
Requirements
Minimum supported client | Windows Vista |
Minimum supported server | Windows Server 2008 |
Header | Settings.h |
IDL | Sidebar.idl |
DLL | Sidebar.Exe version 1.00 or later |
See Also
Send comments about this topic to Microsoft
Build date: 2/24/2010
Build type: SDK