My problem is that my dialog doesn't show.
And it doesn't help that the debugger doesn't seem to step into the sub class's functions. As far as I can tell $ShowDialog contains the write function. I'm wondering if it is unhappy that the dialog is defined in an included file??
Is anyone able to point me in the right direction here?
Thanks
Main.jsx
- Code: Select all
#include "MyDialog.jsx"
#include "AbstractApplicationBase.jsx"
//inherit frrom base class
MyApp.prototype = new AbstractApplicationBase("My App");
//constructor
function MyApp() {};
showDialog = function() {
var form = new MyDialog();
return form.run();
};
runApplication = function() {
//todo implement this
};
readParameters = function() {
return true;
//todo implement this
};
MyApp.prototype.$LaunchCriteria = isCS3Plus;
MyApp.prototype.$ShowDialog = showDialog;
MyApp.prototype.$RunApplication = runApplication;
MyApp.prototype.$ReadParameters = readParameters;
var tmp = new MyApp;
tmp.Run();
AbstractApplicationBase.jsx
- Code: Select all
function AbstractApplicationBase(applicationName) {
this.APP_NAME = applicationName;
}
//MustOverride functions
AbstractApplicationBase.prototype.$LaunchCriteria = function(){};
AbstractApplicationBase.prototype.$ShowDialog = function(){};
AbstractApplicationBase.prototype.$RunApplication = function(){};
AbstractApplicationBase.prototype.$ReadParameters = function(){};
//public properties
AbstractApplicationBase.prototype.LOGGER = undefined;
AbstractApplicationBase.prototype.USER_DIRECTORY= undefined;
AbstractApplicationBase.prototype.SCRIPT_DIRECTORY= undefined;
//Public methods
AbstractApplicationBase.prototype.Run = function(){
app.bringToFront();
if (this.$LaunchCriteria)
{
try {
this._main();
}
catch(e) {
if (e.number != 8007) { // don't report error on user cancel
showError(e);
}
}
}
};
AbstractApplicationBase.prototype._main = function() {
//default to logging
this.LOGGING = true;
this.USER_FOLDER = decodeURI(Folder(Folder.userData)) + "/" + this.APP_NAME.stripSpaces();
if (!this.$ReadParameters)
return;
this.LOGGER = new solib.Log(this.USER_FOLDER +"/" + this.APP_NAME.stripSpaces() + ".log" , true );
this.LOGGER.setDebug(this.LOGGING);
if (this.$ShowDialog) {
this.$RunApplication;
}
}
String.prototype.stripSpaces = function( ){ return this.replace( /\s/g, "" ); };
MyDialog.jsx
- Code: Select all
//Constructor
function MyDialog()
{
this.windowRef = null;
}
MyDialog.prototype.run = function()
{
$.writeln ("inside dialog.run");
var win = new Window("dialog", "MyDialog" );
this.windowRef = win;
// Display the window
win.show();
return true;
}

