First Checked In.

This commit is contained in:
davidm%netscape.com 1999-08-31 02:55:50 +00:00
parent 8aaf33823b
commit d2dfed121f
2 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,56 @@
function selectDialogOnLoad()
{
dump("selectDialogOnLoad \n");
doSetOKCancel( commonDialogOnOK, commonDialogOnCancel );
param = window.arguments[0].QueryInterface( Components.interfaces.nsIDialogParamBlock );
if( !param )
dump( " error getting param block interface\n" );
var msg = param.GetString( 0 );
dump("message: "+ msg +"\n");
SetElementText("info.txt", msg );
listBox = document.getElementById("list");
var numItems = param.GetInt( 2 )
for ( i = 1; i <= numItems; i++ )
{
var newString = param.GetString( i );
dump("setting string "+newString+"\n");
var newOption = new Option( newString );
listBox.options[listBox.options.length] = newOption;
}
dump("number of items "+ listBox.options.length +" "+listBox.length+"\n");
listBox.selectedIndex = 0;
// Move to the right location
moveToAlertPosition();
}
function SetElementText( elementID, text )
{
dump("setting "+elementID+" to "+text +"\n");
var element = document.getElementById(elementID);
if( element )
element.childNodes[0].nodeValue = text;
else
dump("couldn't find element \n");
}
function commonDialogOnOK()
{
dump("commonDialogOnOK \n");
param.SetInt(2, listBox.selectedIndex );
return true;
}
function commonDialogOnCancel()
{
dump("commonDialogOnCancel \n");
param.SetInt(2, listBox.selectedIndex );
param.SetInt(0, 1 );
return true;
}

View File

@ -0,0 +1,29 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://global/locale/commonDialog.dtd">
<window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
align="vertical"
onload="selectDialogOnLoad()"
class="dialog">
<html:script language="JavaScript" src="chrome://global/content/selectDialog.js" />
<box align="vertical" style="width: 24em;margin: 5px;">
<html:div id="info.txt" style="margin-left:2em; margin-right:2em; margin-top:5px;" flex="100%">
&message.label;
</html:div>
<html:select size="10" id ="list" style=" margin-top:5px;margin-left:2em; margin-right:2em;" >
</html:select>
</box>
<box id="okCancelButtons"/>
</window>