Adobe GoLive CS2 Programmer's Manual page 59

Hide thumbs Also See for GoLive CS2:
Table of Contents

Advertisement

SDK Programmer's Guide
After the dialog closes, all of its control objects remain available in the JavaScript namespace, and you
can continue to access their property values.
The following example shows two ways to use the show function's return value.
For a dialog that allows the user only to accept or reject the choice it offers, you can use the
straightforward approach of the mySimpleDialog case.
For a dialog that offers several exit points, take the approach demonstrated by the myRegDialog
case—it uses the show function's return value in a switch statement to determine its actions
according to the button that dismissed the dialog.
// define handler for menu items
function whichDialog(menuEvt) {
switch(menuEvt.target.name) {
} // end switch menuItem
} // end function
// register handler
function initializeModule() {
app.addEventListener( 'menuSignal', whichDialog, true);
}
// how to call show for simple Cancel/OK dialog
case "mySimpleDialog":
if (myOtherDialog.show())
Window.alert("That was a wise decision!");
else
Window.alert ("Are you sure you want to cancel?");
break;
// how to call show for multi-button dialog
case "myRegDialog":
// shareware registration dialog example
switch (myRegDialog.show())
{
case 1:
// accept user input
var userName = myDialog.myNameField.value;
var credit = myDialog.myCreditCardField.value;
break;
case 0:
// restore defaults
myDialog.myNameField.value = "";
myDialog.myCreditCardField.value = "";
break;
case 3:
// a third alternative
myDialog.myNameField.text = "Demo User";
myDialog.myCreditCardField.value = "DEMO DEMO DEMO DEMO";
setUpAsDemoVersion();
break;
} // end switch myRegDialog.show
break;
Adobe GoLive CS2 SDK
Windows and Controls
59

Advertisement

Table of Contents
loading

Table of Contents