System.Gadget.Settings.ClosingEvent.cancel Property
Gets or sets whether to cancel the onSettingsClosing event.
This property is read/write.
Syntax
propVal = System.Gadget.Settings.ClosingEvent.cancel(bCancel)
System.Gadget.Settings.ClosingEvent.cancel(bCancel)
= propVal
Parameters
bCancel [in]
bCancel [out]
Sets or retrieves whether to cancel the event.Value Meaning false Default. Event is not cancelled.
true Default. Event is cancelled.
Remarks
Useful for situations where a Settings form requires particular fields to be modified before the user can click Ok. This ensures the Settings dialog can stay open until all required information is entered.
Examples
The following example demonstrates how to ensure the Settings dialog closes when desired.
// Delegate for the settings closing event.
System.Gadget.onSettingsClosing = SettingsClosing;
// --------------------------------------------------------------------
// Handle the Settings dialog closing event.
// Parameters:
// event - System.Gadget.Settings.ClosingEvent argument.
// --------------------------------------------------------------------
function SettingsClosing(event)
{
// User hit OK on the settings page.
if (event.closeAction == event.Action.commit)
{
if (txtUserEntry.value != "")
{
System.Gadget.Settings.writeString(
"settingsUserEntry", txtUserEntry.value);
// Allow the Settings dialog to close.
event.cancel = false;
}
// No user entry, cancel the Settings closing event.
else
{
event.cancel = true;
}
}
}
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.ClosingEvent
Send comments about this topic to Microsoft
Build date: 2/24/2010
Build type: SDK