This works as expected in Windows but not in OS4.
I am trying to get the name of the Parent of the selected node.
Code: Select all
@REQUIRE "RapaGUI"
moai.CreateApp([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application>
<window title="Test" id="main" notify="closerequest" width="200">
<vgroup>
<treeview id="tree">
<column/>
<node name="Level 1">
<node name="Level 2">
<node name="Level 3">
</node>
<node name="Level 4">
<node name="Level 5">
</node>
</node>
</node>
</node>
<node name="Category 1">
<node name="Category 2">
<node name="Category 3">
</node>
</node>
</node>
</treeview>
<text id="name"></text>
<hgroup>
<button id="parent"> Parent </button>
<button id="quit"> Quit </button>
</hgroup>
</vgroup>
</window>
</application>
]])
Function p_EventFunc(msg)
Switch msg.action
Case "RapaGUI":
Switch msg.attribute
Case "Pressed":
Switch msg.id
Case "quit"
End
Case "parent"
Local Found, p = moai.DoMethod("tree", "GetEntry", "Active", "Parent")
If Found = 1
Parent$, B$ ,C$ = unpack(p.items)
moai.Set("name", "Text", unpack(p.items))
Else
moai.Set("name", "Text", " At Root Level ")
Endif
EndSwitch
Case "CloseRequest"
Switch msg.id
Case "main"
End
EndSwitch
EndSwitch
EndSwitch
EndFunction
InstallEventHandler({RapaGUI = p_EventFunc})
Repeat
WaitEvent
Forever
Leo