Tue 27 Aug 00:14:56 CEST 2024
This commit is contained in:
parent
357b4670ed
commit
c3edce729d
45
test/test-ui2.js
Normal file
45
test/test-ui2.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
// 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();
|
Loading…
Reference in New Issue
Block a user