Created
June 10, 2016 07:43
-
-
Save milligramme/05d01ecba74d1072fd17a05cd18ab64f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#targetengine "poo" | |
var u; | |
var w = new Window('window', "list item destroy", u, {closeButton:true, minimizeButton:true, maximizeButton:false, resizeable:false, borderless:false}); | |
w.orientation = 'column'; | |
w.margins = 5; | |
w.spacing = 5; | |
w.alignChildren = ['fill', 'fill']; | |
var s_panel = w.add('panel'); | |
var l_panel = w.add('panel'); | |
s_panel.add("statictext", u, "StaticText"); | |
var scrollbox = s_panel.add('statictext', [0,0,320,240], 'index, value1, value2', {multiline:true,scrollable:true}) | |
btn_add_scrollbox = s_panel.add('button', u, "add to scrollbox") | |
btn_remove_scrollbox = s_panel.add('button', u, "remove from scrollbox") | |
btn_add_scrollbox.onClick = function () { | |
var init = ['index, value, value']; | |
var s = new Date(); | |
for (var i = 0; i < 100; i++) { | |
init.push([i.toString(), Math.random().toString(), Math.random().toString()].join(", ")); | |
} | |
scrollbox.text = init.join("\n"); | |
alert((new Date() - s)+"msec"); | |
} | |
btn_remove_scrollbox.onClick = function () { | |
var s = new Date(); | |
var init = ['index, value, value']; | |
scrollbox.text = init.join("\n"); | |
alert((new Date() - s)+"msec"); | |
} | |
l_panel.add("statictext", u, "ListBox/ListItems"); | |
var listbox = l_panel.add('listbox', [0,0,320,240], "", { | |
numberOfColumns: 3, | |
showHeaders: true, | |
columnTitles: ["index", "value1", "value2"] | |
}); | |
btn_add_listitems = l_panel.add('button', u, "add listitems"); | |
btn_remove_listitems = l_panel.add('button', u, "remove listitems"); | |
btn_add_listitems.onClick = function () { | |
var s = new Date(); | |
for (var i = 0; i < 100; i++) { | |
itm = listbox.add('item', i.toString()); | |
itm.subItems[0].text = Math.random().toString(); | |
itm.subItems[1].text = Math.random().toString(); | |
} | |
alert((new Date() - s)+"msec"); | |
} | |
btn_remove_listitems.onClick = function () { | |
var s = new Date(); | |
listbox.removeAll(); // => DEADLY SLOW | |
alert((new Date() - s)+"msec"); | |
} | |
w.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment