System.Gadget.Settings.readString Method

Retrieves a stored String value associated with a gadget Settings key.

Syntax

strSetting = System.Gadget.Settings.readString(
  strName
)

Parameters

  • strName [in]
    BSTR String that specifies or receives the name of the Settings key.
  • strSetting
    BSTR The String value of the Settings key.

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.readString("settingsUserEntry");
        // Update gadget UI based on user Settings input.
        SetContentText(userEntry);
    }
    // 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
IDL Sidebar.idl
DLL Sidebar.Exe version 1.00 or later

See Also

System.Gadget.Settings

writeString

 

 

Send comments about this topic to Microsoft

Build date: 2/24/2010

Build type: SDK