Treeview GetEntry "Parent" not working as expected OS4

Report any Hollywood bugs here
Post Reply
User avatar
Redlion
Posts: 107
Joined: Sun Jul 10, 2011 5:05 am
Location: Perth, Western Australia

Treeview GetEntry "Parent" not working as expected OS4

Post by Redlion »

Hi,

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
Cheers
Leo
----------------------------------------------------------------------------------------
Redlion
Sam460 Lite
A4000 A3000 A2000 A1200 A1000 A600 A500 CD32
User avatar
airsoftsoftwair
Posts: 5594
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Treeview GetEntry "Parent" not working as expected OS4

Post by airsoftsoftwair »

Yes, this seems to be related to the other issues in the Treeview widget when using MUI already discussed here. Will be fixed...
User avatar
airsoftsoftwair
Posts: 5594
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Treeview GetEntry "Parent" not working as expected OS4

Post by airsoftsoftwair »

Code: Select all

- Fix [Amiga]: Passing "Active" as the item parameter in Treeview.GetEntry() often didn't work correctly
Post Reply