20,741
edits
m (→Canvas Code (proof-of-concept): re-structure for table support) |
|||
| Line 59: | Line 59: | ||
# for faster testing, let's use a vector with dummy data to be shown matching the columns of the hard-coded widget: | # for faster testing, let's use a vector with dummy data to be shown matching the columns of the hard-coded widget: | ||
var dummyData = [ | |||
{target: 0, latitude:0, longitude:0, ETA:0}, | |||
]; | |||
| Line 79: | Line 78: | ||
{ | { | ||
print("Cleaning up window:",title,"\n"); | print("Cleaning up window:",title,"\n"); | ||
# explanation for the call() technique at: http://wiki.flightgear.org/Object_oriented_programming_in_Nasal#Making_safer_base-class_calls | |||
call(canvas.Window.del, [], me); | call(canvas.Window.del, [], me); | ||
}; | }; | ||
| Line 103: | Line 102: | ||
var list = canvas.VBoxLayout.new(); | var list = canvas.VBoxLayout.new(); | ||
scroll.setLayout(list); | scroll.setLayout(list); | ||
var addTable = func(scrollContent, list) { | |||
for (var i=1;i<=5;i+=1) { | for (var i=1;i<=5;i+=1) { | ||
| Line 110: | Line 112: | ||
list.addItem(label); | list.addItem(label); | ||
} | } | ||
} | |||
addTable(scrollContent, list); | |||
</syntaxhighlight> | </syntaxhighlight> | ||