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

Debugging callback functions

$
0
0

Am I right with my observations?

Ordinary (not named) callback functions are all listed as (for example) onClick() in the Functions pane of ESTK. In addition local variables in these functions are not listed in the Data Browser. Hence IMHO debugging is not possible.

So I tried the method with named callback functions which avoids both drawbacks:

Unnamed callback functionsNamed callback functions
myDlg.btn2.onClick = function() {  $.bp(true);  aLocal = "gugus";  if (this.text == 'Disable Him') {    this.text = 'Enable Him';    myDlg.btn1.enabled = false;  } else {    this.text = 'Disable Him';    myDlg.btn1.enabled = true;  }
}
myDlg.btn2.onClick = ActButton2;
// ...
function ActButton2 () {
$.bp (true);  var aLocal = "gugus";  if (this.text == 'Disable Him') {    this.text = 'Enable Him';    myDlg.btn1.enabled = false;  } else {    this.text = 'Disable Him';    myDlg.btn1.enabled = true;  }
}
variable aLocal is not listed in Data Browservariable aLocal is listed in Data Browser
All functions are named onClick in the Functions paneFunctions have distinct names in the Functions pane
callback functions are within the window functioncallback functions (are) / (may be) outside the window function

 

Of course the names for the named callback functions must be unique for the whole script.


Viewing all articles
Browse latest Browse all 888

Trending Articles



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