New page/window now working

This commit is contained in:
2023-12-27 22:24:20 +11:00
parent 7b34decb49
commit d9b056c5cd
8 changed files with 188 additions and 235 deletions

View File

@@ -10,27 +10,27 @@
* (Tags are added to the messages via an external process.)
*/
// All controls need a unique variable so that require() can know if the control has already been loaded
var CONTROL_ECHOMAIL = '1';
//load('frame.js');
//load('graphic.js');
// Optional debug message so we can see that it is loaded
log(LOG_DEBUG,'+ Control ECHOMAIL loaded');
function echomail(page) {
// A unique method name (same as the control name that is called as new method() on initialisation
function echomail(pagenum,session) {
log(LOG_DEBUG,' - Loading echomail page:'+pagenum);
// has this control completed
var complete = false;
var pageframe = undefined;
log(LOG_DEBUG,'Loading echomail page:'+page);
var ready = false;
// Setup our frame
fo = viewdata ? new FrameViewdata() : new FrameAnsi();
fo.loadMessage(page,viewdata ? 'vtx' : 'tex');
function init(pagenum,session) {
log(LOG_DEBUG,'- init()');
if (fo.content)
pageframe = fo.render();
ready = session.loadMessage(pagenum);
}
// Called before processing for a field
Object.defineProperty(this, 'getName', {
get: function () {
return 'ECHOMAIL';
@@ -44,40 +44,39 @@ function echomail(page) {
});
// Handle the keyboard responses as we receive them.
this.handle=function(read) {
this.handle = function(read) {
log(LOG_DEBUG,'Control ECHOMAIL handle() start. ('+read+')');
switch(read) {
case KEY_DOWN:
log(LOG_DEBUG,' - Control TEST scroll 0,1');
pageframe.scroll(0,1);
session.page.scroll(0,1);
read = '';
break;
case KEY_UP:
log(LOG_DEBUG,' - Control TEST scroll 0,-1');
pageframe.scroll(0,-1);
session.page.scroll(0,-1);
read = '';
break;
}
pageframe.cycle();
so.render();
return read;
}
// @todo Does this need to be defined?
this.prefield=function() {};
this.ready=function() {
//log(LOG_DEBUG,' - pageframe:'+pageframe+',typeof:'+(typeof pageframe));
if ((typeof pageframe) === 'undefined')
log(LOG_DEBUG,'+ Control ECHOMAIL page doesnt exist ['+page+']');
else
log(LOG_DEBUG,'+ Control ECHOMAIL ready');
return (typeof pageframe) !== 'undefined';
/**
* ready() is called after a control has been initialised, to determine if the control will take the input
* or if it is unable to do so
*
* If ready() returns:
* + false, the main programming will return ERR_ROUTE to the user,
* + true, the main programming will continue to load the frame, and then pass input to on the next loop handle()
*
* @returns {boolean}
*/
this.ready = function() {
return ready;
}
}
this;
init.apply(this,arguments);
}