46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
|
// 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:'Select Button Demo'}),
|
||
|
check1 : ui.checkbox({left:1,top:6,text:'Select 1',value:false}),
|
||
|
check2 : ui.checkbox({left:1,top:8,text:'Select 2',value:true}),
|
||
|
check3 : ui.checkbox({left:1,top:10,text:'Select 3',value:false}),
|
||
|
radio1 : ui.radiobutton({left:1,top:12,text:'Choice 1', group:1, value:false}),
|
||
|
radio2 : ui.radiobutton({left:1,top:14,text:'Choice 2', group:1 ,value:true}),
|
||
|
radio3 : ui.radiobutton({left:1,top:16,text:'Choice 3', group:1,value:false}),
|
||
|
info1 : ui.info({right:1, top:6, width:40, 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.screen.key(['escape', 'q', 'C-c'], exit2);
|
||
|
ui.pages[1].check1.on('select',Log);
|
||
|
ui.pages[1].check2.on('select',Log);
|
||
|
ui.pages[1].check3.on('select',Log);
|
||
|
ui.pages[1].radio1.on('select',Log);
|
||
|
ui.pages[1].radio2.on('check',Log);
|
||
|
ui.pages[1].radio3.on('check',Log);
|
||
|
|
||
|
ui.start();
|