In this I am exploring another two features of Gadget API, one is Docking and other is Flyout. The Docking feature is helpful in Windows Vista, because the gadget lives only in Vista Sidebar, but in Windows 7 it can be anywhere in the desktop. The Docking feature helps to change the size of Gadget, in Windows Vista, the docking / un-docking events will automatically fired, when we drag the gadget out of the sidebar, but in Windows 7 another button will displayed in the Gadget toolbox. You can query the current state of a gadget with System.Gadget.docked. It returns true if docked, false if undocked.

Docking / UnDocking button in Sidebar
There are also two events that you can monitor, System.Gadget.onDock and System.Gadget.onUndock, to determine when the docking state changes.
You can change the Width of the gadget by calling document.body.style.width = “130px”;. And the Docking and Undocking events should be attached on the Page_load.
System.Gadget.onDock = dockStateChanged;
System.Gadget.onUndock = dockStateChanged;
And the dockStateChanged function is
function dockStateChanged() {
//Checks the current state of the Gadget, if Docked state, setting the width to 130px;
//Otherwise changing to 330px;
if (System.Gadget.docked) {
document.body.style.width = "130px";
document.getElementById("RSSOutput").style.width = "125px";
} else {
document.body.style.width = "330px";
document.getElementById("RSSOutput").style.width = "325px";
}
}
Another feature is Flyout. Flyouts used to extend the Gadget UI. The flyouts are system modal—only one can be displayed at a time. And when a gadget loses focus, its flyout will close. API for Flyouts available under System.Gadget.Flyout. As the flyouts is completely a separate window, with its own DOM, helps to add / create controls dynamically in it. Also you need to specify the flyout file, like Settings file.
The System.Gadget.Flyout.document returns the Document object of the flyout window. To display a flyout you need to set Flyout.show to True and to hide, set it to false. This property also returns the current state of flyout. But we cannot control the location of side bar, it is managed by Sidebar or OS.
System.Gadget.Flyout.file = "flyout.html";
There are certain events also available for Flyouts
System.Gadget.Flyout.onShow = function()
{
//Do something, when flyout is opening, may be a dynamic control creation
}
System.Gadget.Flyout.onHide = function()
{
//Do some code.
}