// jamsh var ui = UI.UI({ pages : 1, styles : {}, terminal: '', title : 'Test APP' }); function exit2() { process.exit(); } print(ui) ui.init(); ui.pages[1]={ quit : ui.button({left:1,top:1,content:'QUIT', action:exit2}), label1 : ui.label({right:1,top:2, content:'Terminal Demo'}), term1 : ui.terminal({left:1, top:6, width:40, height:10, prompt:'> ', label:'Terminal'}), info1 : ui.info({right:1, top:6, width:34, height:14, multiline:true, wrap:true, scrollable:true, label:'Info'}), } _logs=[] Log = function () { var line = Array.prototype.slice.call(arguments).map(function (arg) { return inspect(arg) }).join(' '); _logs.push(_logs.length+':'+line); ui.pages[1].info1.setValue(_logs.join('\n')); ui.pages[1].info1.scrollBottom(); } ui.pages[1].term1.on('eval',function (cmd) { Log(cmd); if (cmd!=null) ui.pages[1].term1.print(cmd); ui.pages[1].term1.print('Ok.'); }); ui.pages[1].term1.on('clicked',function (ev) { // Log(ev); }); ui.pages[1].term1.on('keypress',function (ch,key) { // Log(key); }); ui.screen.key(['escape', 'q', 'C-c'], exit2); ui.start();