Quantcast
Channel: Adobe Community : All Content - FrameMaker Scripting
Viewing all articles
Browse latest Browse all 888

Nested dialogue problem

$
0
0

Dear experts,
From a palette i need to divert into a dialgoue and then come back into the palette.
This works fine for the first time i enter the dialogue. The dialogue fails when entered the second time.
A stripped down version of my scripts is following. The palette is to the left, the 'test' dialogue to the right:

dialogues.png

  • Usage is as follows:
  • In the palette active the checkbox and clik the Handle Content button.
  • This invokes the 'test' dialogue.
  • According to the settings in the script the OK/Return button is hidden.
  • Clicking the Cancel button closes this dialogue and we are back in the palette.
  • Since the 'test' was cancelled, an alert appears with NO as default.
  • Click NO
  • The check box is cleared for a new decision
  • Now the user 'changes the input (top field)', checks the box and clicks the Handle ... button.
  • => Error on line 48: undefined is not an object.

What may be wrong here?

// NestedDialogue.jsx
#target framemaker
// target needed for Alert ...
var gsVariable;
var wPalDS = new Window('palette',"FM-calc : Manage Variables",undefined);
var wPalV  = new Window('dialog', "FM-calc : Check contents of variable", undefined);

PaletteDocSettings();
// ================================================================================================
function PaletteDocSettings(){ //=== Outer function
    wPalDS.sVarValue = wPalDS.add('edittext',undefined,"Content to be handled", {multiline:true});    wPalDS.sVarValue.alignment = ['right',' '];    wPalDS.cbChkContent = wPalDS.add('checkbox',undefined,"Use secondary dialogue");     wPalDS.btnAdd = wPalDS.add('button',undefined,"Handle content");  wPalDS.Cancel = wPalDS.add('button',undefined,"Cancel");  wPalDS.Cancel.onClick = function () {    wPalDS.close();   }    wPalDS.btnAdd.onClick = ButtonAddVarConst;    // externalised callback function!   wPalDS.show();
} //---  end PaletteDocSettings

function ButtonAddVarConst () {
var bContinue, content;
// $.bp(true);
  content =  wPalDS.sVarValue.text;  if (wPalDS.cbChkContent.value) {  // check contents    gsVariable = "=" + content;    DialogueVerify();                             // Inner function    bContinue = wPalV.btnReturn.enabled;    if (!bContinue) {      if (Alert ("Test failed, continue anyway?", Constants.FF_ALERT_NO_DEFAULT) != 0) {        wPalDS.cbChkContent.value = false;        // uncheck        return;                                   // user clicked NO      }    }    content = gsVariable.substring (1);         // skip the = sign    wPalDS.sVarValue.text = content;  }
} //--- end ButtonAddVarConst

function DialogueVerify(){ //=== Dialogue for verifying variable contents
  wPalV.st1 = wPalV.add('statictext',undefined,"Content to check");  wPalV.st1.graphics.font = ScriptUI.newFont(wPalV.st1.graphics.font.family,"BOLD",wPalV.st1.graphics.font.size);  wPalV.btnReturn = wPalV.add('button',undefined,"OK / Return");  wPalV.btnReturn.helpTip = "Return to calling dialogue";  wPalV.Cancel = wPalV.add('button',undefined,"Cancel");  wPalV.Cancel.alignment = ['right',' '];  wPalV.btnReturn.onClick =   ButtonReturnV;   // externalised callback function!  wPalV.Cancel.onClick = function () {    wPalV.close();  }  wPalV.btnReturn.enabled = false;             // test situation 1 (using Cancel to exit)
//wPalV.btnReturn.enabled = true;              // test situation 2 (using this button to exit)  wPalV.show();
}

function ButtonReturnV () {
  wPalV.close();
} //---  end ButtonReturnV

Any ideas are welcome ...


Viewing all articles
Browse latest Browse all 888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>