Code: Select all
/*Tree test*/
@REQUIRE "RapaGUI"
Function TableDump(t)
For k, v In Pairs(t)
debugPrint("key="..k)
Next
EndFunction
Function Test()
Local found1, table1=moai.DoMethod("tv", "GetEntry", "Active", "Previous")
Local found2, table2=moai.DoMethod("tv", "GetEntry", "Active", "Active")
Local found3, table3=moai.DoMethod("tv", "GetEntry", "Active", "Next")
If found1 Then tableDump(table1) Else DebugPrint("NotFound1")
If found2 Then tableDump(table2) Else DebugPrint("NotFound2")
If found3 Then tableDump(table3) Else DebugPrint("NotFound3")
EndFunction
moai.CreateApp([[<?xml version="1.0" encoding="iso-8859-1"?>
<application id="RapaEdit">
<window id="win_" title="TreeTest">
<vgroup>
<treeview id="tv">
<column />
<node name="root">
<leaf id="item1">
<item>First</item>
</leaf>
<leaf id="item2">
<item>Second</item>
</leaf>
<leaf id="item3">
<item>Third</item>
</leaf>
</node>
</treeview>
</vgroup>
</window>
</application>
]])
moai.DoMethod("tv", "open", "root")
moai.Set("tv", "Active", "item2")
Test()
Repeat
WaitEvent
Forever