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 functions | Named 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 Browser | variable aLocal is listed in Data Browser |
All functions are named onClick in the Functions pane | Functions have distinct names in the Functions pane |
callback functions are within the window function | callback functions (are) / (may be) outside the window function |
Of course the names for the named callback functions must be unique for the whole script.