Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

System.Gadget.Settings.ClosingEvent.cancel property

[The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. ]

Gets or sets whether to cancel the onSettingsClosing event.

This property is read/write.


bcancel = System.Gadget.Settings.ClosingEvent.cancel
System.Gadget.Settings.ClosingEvent.cancel = bcancel

Property value

A Boolean that specifies or receives whether to cancel the event.


Default. Event is not canceled.


Default. Event is canceled.


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.


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 != "")
                "settingsUserEntry", txtUserEntry.value);
            // Allow the Settings dialog to close.
            event.cancel = false;
        // No user entry, cancel the Settings closing event.
            event.cancel = true;  


Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

End of client support

Windows 7

End of server support

Windows Server 2008




Sidebar.Exe (version 1.00 or later)



Community Additions

© 2015 Microsoft