Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vista Gadget Flyout

Status
Not open for further replies.

warmdownhere

Programmer
Aug 23, 2008
5
US
Anyone know a way to keep the flyout open when its focus is lost? My gadget plays a Flash video with links, if a link is clicked the gadget focus is lost and closes. I would like to keep the Flash video flyout open.

Thanks,

Ted
 
Here is the main html page calling the flyout:

<link href="css/main.css" rel="stylesheet" type="text/css"/>
<script src="generic.js" type="text/javascript" language="javascript"></script>
<script src="custom.js" type="text/javascript" language="javascript"></script>
<script src="scripts/microsoftajax.js" type="text/javascript" language="javascript"></script>
<script src="scripts/proxy.js" type="text/javascript" language="javascript"></script>
<head>
<title>Pause And Buy</title>
<style>
body {
width:128;
height:115;
}

#Select1
{
font-size: xx-small;
font-family: Tahoma;
}

#playButton
{
width: 106px;
}

</style>
</head>
<body background="images/Background.png" onload="init(); loadme();" class="DockedModeDisplayArea">
<p style="background-repeat: no-repeat; font-family: Tahoma; font-size: xx-small;">

<form name="playerform">

<a href=" target="_blank"> <img alt="website" src="images/PB_Logosmall.png" border="0" style="width: 101px; height: 17px" /> </a>
select movie:
<br /> <select name="player" id="Select1">
</select><br /><br />
<button id="flyButton" onclick="showFlyout()" style="font-family: Tahoma; font-size: xx-small">View</button>

</form>
</body>

Here is the Generic.js:

function init ( )
{
Trace("init started"); //Just for sample, good to do via dbgview (from sysinternals.com )
settingsChanged();

System.Gadget.settingsUI = "settings.htm"; // This tells the gadget the HTML file to launch for settings
System.Gadget.onSettingsClosed = settingsClosed; //wire ourselves to settings closed event to save them
System.Gadget.visibilityChanged = visibilityChanged; // stop working if we are not visible
System.Gadget.onUndock = chkdockedState; //let me know if I get undocked so I can look different
System.Gadget.onDock = chkdockedState;
System.Gadget.onShowSettings = showSettings ; // let me know if settings are being shown

System.Gadget.Flyout.onHide = flyoutHiding; //let me know if flyout is showing/hiding. I can pass data to it via document property
System.Gadget.Flyout.onShow = flyoutShowing;

Trace("init ended");
}

function showSettings ( )
{
Trace("showSetttings started ") ;
Trace("showSetttings ended") ;
}

function settingsClosed(event)
{
Trace ( "settingsClosed started ") ;
if (event.closeAction == event.Action.commit)
{
settingsChanged();
}


Trace ( "settingsClosed ended ") ;
}

function settingsChanged()
{
}

function visibilityChanged()
{
}

function chkdockedState()
{
if (!System.Gadget.docked)
{
Trace("Undocked");
document.body.className = "UnDockedModeDisplayArea" ;

}
else
{
Trace ("Docked") ;
document.body.className = "DockedModeDisplayArea" ;
}
}


function Trace ( str )
{
// Should we use System.Debug.outputString ??
System.Debug.outputString ( "gadget " + str );
// Debug.write ( str ) ;
}

function GetXMLHTTP ()
{
var xmlhttp = null ;
if (window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
if ( typeof xmlhttp.overrideMimeType != 'undefined')
xmlhttp.overrideMimeType('text/xml');
}
else if (window.ActiveXObject)
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
throw "No XMLHTTP" ;
}
return xmlhttp;
}


function flyoutShowing ( )
{
Trace ( "flyOutShowing");
document.getElementById("flyButton").value="Close";
document.getElementById("Select1").disabled = true;
}

function flyoutHiding ( )
{
Trace ( "flyOutHiding");
document.getElementById("flyButton").value="View";
document.getElementById("Select1").disabled = false;
loadme();
}

Here is the flyout HTML page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " <link href="css/main.css" rel="stylesheet" type="text/css"/>
<script src="generic.js" type="text/javascript" language="javascript"></script>
<script src="custom.js" type="text/javascript" language="javascript"></script>
<style>
body
{
width:460px;
height:300px;
margin:0px;
}
</style>


<html xmlns="<head>
<title>Movie FlyOut</title>
</head>
<body>
<script type="text/javascript">
var movieID = "movieID=" + System.Gadget.Settings.read("myID");

document.write(
'<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"\n'+
' codebase=" ' WIDTH="460" HEIGHT="300" id="flaMovie1">\n'+
' <PARAM NAME=movie VALUE=" ' <PARAM NAME=FlashVars VALUE="'+movieID +'">\n'+
' <PARAM NAME=quality VALUE=high>\n'+
' <PARAM NAME=bgcolor VALUE=#FFFFFF>\n'+
' <EMBED src=" ' FlashVars="'+movieID+'"\n'+
' quality=high bgcolor=#FFFFFF WIDTH="460" HEIGHT="300" NAME="flaMovie1"\n'+
' TYPE="application/x-shockwave-flash"\n'+
' PLUGINSPAGE=" '</OBJECT>');
</script>
</body>
</html>

Hope this is enough :) Thanks!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top