Skip to content

Instantly share code, notes, and snippets.

@mazgi
Created August 9, 2013 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mazgi/6193049 to your computer and use it in GitHub Desktop.
Save mazgi/6193049 to your computer and use it in GitHub Desktop.
JSXでログコンソールっぽいものつくってみた
var dlg = new Window('dialog', 'Alert Box Builder'); dlg.msgPnl = dlg.add('panel', undefined, 'Messages');
dlg.msgPnl.titleSt = dlg.msgPnl.add('statictext', undefined, 'Alert box title:');
dlg.msgPnl.titleEt = dlg.msgPnl.add('edittext', undefined, 'Sample Alert');
dlg.msgPnl.msgSt = dlg.msgPnl.add('statictext', undefined, 'Alert message:');
var date = new Date();
// create list box with two titled columns
var list = dlg.msgPnl.add ('ListBox', [0, 0, 400, 180], 'asd', {numberOfColumns: 4, showHeaders: true, columnTitles: ['Index', 'Date', 'Function', 'Message']});
// add an item for the first row, with the label value for the first column
//var item1 = list.add ('item', 'John');
// add the label value for the second column in that row.
//item1.subItems[0].text = 'Doe';
// add an item for the second row, with the text for the first column label
//var item2 = list.add ('item', 'Jane');
// add the label text and image for the second column in the second row
//item2.subItems[0].text = 'Doe';
dlg.msgPnl.msgEt = dlg.msgPnl.add('edittext', [0, 0, 400, 180], '<your message here>', {multiline:true});
var editText = dlg.msgPnl.msgEt;
for(var i = 0; i < 20; i++) {
editText.text += "\ntext" + i;
var item = list.add ('item', i);
item.addEventListener( 'click', 'function(e){ alert(e); }');
item.selected = true;
item.subItems[0].text = date.toLocaleString() + i;
item.subItems[1].text = 'Func' + i;
item.subItems[2].text = 'Msg' + i;
}
dlg.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment