Share via


System.Gadget.endTransition Method

Refreshes the gadget view and resumes updates, animations, and effects once a gadget 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.endTransition(
  intTransition,
  fSeconds
)

Parameters

  • intTransition [in]
    GadgetTransitionType The transition type or effect.
    Value Meaning
    0

    None. No transition effect applied during gadget docking or undocking.

    1

    Morph. The gadget's visual appearance "morphs" from one state to another during gadget docking or undocking.

     
  • fSeconds [in]
    float The number of seconds desired to complete the docking or undocking transition.

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 beginTransition to suspend all gadget updates, animations, and effects.

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

System.Gadget

 

 

Send comments about this topic to Microsoft

Build date: 2/24/2010

Build type: SDK