Tue 27 Aug 00:14:56 CEST 2024

This commit is contained in:
sbosse 2024-08-27 00:15:28 +02:00
parent 2e68b31360
commit c38fe8d7a2

41
test/test-ui5.js Normal file
View File

@ -0,0 +1,41 @@
// jamsh
var ui = UI.UI({
pages : 1,
styles : {},
terminal: '',
title : 'Test APP'
});
function exit2() {
process.exit();
}
print(ui)
ui.init();
var data = [
['X','Y','Z'],
['0','0','0'],
['0','1','1'],
['1','0','1'],
['1','1','0'],
]
ui.pages[1]={
quit : ui.button({left:1,top:1,content:'QUIT', action:exit2}),
label1 : ui.label({right:1,top:2, content:'Table Demo'}),
table1 : ui.table({left:1,top:6, width:30, data:data, header:{bold:true}}),
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.start();