System.Gadget.beginTransition Method
Suspends all gadget updates, animations, and effects until a docking or undocking transition has completed.
Note For Windows 7, calls to the System.Gadget.beginTransition and System.Gadget.endTransition methods are ignored.
Syntax
System.Gadget.beginTransition()
Parameters
This method has no parameters.
Return Value
This method does not return a value.
Remarks
beginTransition and endTransition enclose the code that defines the visual effects to execute during gadget docking and undocking transitions.
Use endTransition to resume updates and refresh the gadget view once the docking or undocking transition has completed.
Examples
The following example demonstrates how to use beginTransition and endTransition with the "morph" transition type.
// Gadget width and height.
var gadgetWidth = 130;
var gadgetHeight = 108;
// Amount to scale gadget when docked or undocked.
var scaleDocked = 1;
var scaleUndocked = 2;
// Amount of time desired to perform transition (in seconds).
var timeTransition = 2;
// Declare the dock and undock event handlers.
System.Gadget.onDock = CheckDockState;
System.Gadget.onUndock = CheckDockState;
// --------------------------------------------------------------------
// Check the gadget dock state; set the gadget style.
// imgBackground is the value of the 'id' attribute for the
// g:background element.
// --------------------------------------------------------------------
function CheckDockState()
{
var oBackground = document.getElementById("imgBackground");
// Set the width of the background element to 0.
// This forces the image to be refreshed appropriately.
oBackground.style.width = 0;
System.Gadget.beginTransition();
var oBody = document.body.style;
if (System.Gadget.docked)
{
oBody.width = gadgetWidth*scaleDocked;
oBody.height = gadgetHeight*scaleDocked;
oBackground.src = "url(../images/bg_docked.png)";
txtDocked.className = 'gadgetDocked';
txtDocked.innerText = 'Docked';
}
else
{
oBody.width = gadgetWidth*scaleUndocked;
oBody.height = gadgetHeight*scaleUndocked;
oBackground.src = "url(../images/bg_undocked.png)";
txtDocked.className = 'gadgetUndocked';
txtDocked.innerText = 'Undocked';
}
System.Gadget.endTransition(System.Gadget.TransitionType.morph, timeTransition);
}
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
Send comments about this topic to Microsoft
Build date: 2/24/2010
Build type: SDK