RapaGUI 1.1 GetEntry method

Report any Hollywood bugs here

RapaGUI 1.1 GetEntry method

Postby SamuraiCrow » Mon Jun 26, 2017 5:28 pm

I can load a file created with a generator in my Table Editor. The problem is it won't save correctly if an empty node is present.

Image
The screenshot above is a successful load after generating a file using the tester script pictured in the upper-left corner.

After saving with the following code and loading back is illustrated in the screenshot below:
Code: Select all
/*
** Convert a Treeview to a table
*/
Function p_TreeToTable()

   return(p_TreeRecursion({},"Root"))

EndFunction

; worker function for p_TreeToTable
Function p_TreeRecursion(self, node)

   Local test, entry = moai.DoMethod("tree", "GetEntry", node, "Head")
   While test
      DebugPrint("entering with "..entry.items[0])
      If entry.Node = False
         self[entry.items[0]] = moai.Get(entry.ID, "userdata")
      Else
         DebugPrint("recurring with "..entry.items[0])
         self[entry.items[0]] = p_TreeRecursion({}, entry.UID)
      EndIf
      test, entry = moai.DoMethod("tree", "GetEntry", entry.UID, "Next")
      DebugPrint(IIf(test,"not done","done"))
   Wend
   DebugPrint("Returning")
   Return(self)

EndFunction


/*
** Save
*/
Function p_Save()
   
   moai.Set("status", "text", "Saving file")
   Local table = p_TreeToTable()
   Local currentfile = OpenFile(Nil, projectname$, #MODE_WRITE)
   WriteTable(currentfile, table)
   CloseFile(currentfile)
   
   table=Nil
   CollectGarbage()

   changed = False
   saved = True
   p_UpdateTitle()
   p_UpdateButtonState()
   moai.Set("status", "text", "Ready")
   
EndFunction   


Image
SamuraiCrow
 
Posts: 105
Joined: Fri May 15, 2015 5:15 pm
Location: Ft. Collins, Colorado USA

Re: RapaGUI 1.1 GetEntry method

Postby SamuraiCrow » Tue Jun 27, 2017 6:38 am

Reduced images:
Image
Image
SamuraiCrow
 
Posts: 105
Joined: Fri May 15, 2015 5:15 pm
Location: Ft. Collins, Colorado USA

Re: RapaGUI 1.1 GetEntry method

Postby airsoftsoftwair » Tue Jun 27, 2017 5:39 pm

Can you elaborate some more on this? From what you wrote I don't understand where you suspect a bug here. Are you saying that there is a bug in WriteTable(), ReadTable() or Treeview.GetEntry()?
User avatar
airsoftsoftwair
 
Posts: 2283
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: RapaGUI 1.1 GetEntry method

Postby SamuraiCrow » Wed Jun 28, 2017 2:32 am

Treeview.GetEntry skips a record when it encounters an empty node. If the empty node is gone, the subroutine listed above works. The "next" mode is wrong.
SamuraiCrow
 
Posts: 105
Joined: Fri May 15, 2015 5:15 pm
Location: Ft. Collins, Colorado USA

Re: RapaGUI 1.1 GetEntry method

Postby airsoftsoftwair » Sat Jul 01, 2017 10:48 pm

Right, I can confirm this. It works correctly on AmigaOS, though, but not on the other platforms. Thanks for reporting!
User avatar
airsoftsoftwair
 
Posts: 2283
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: RapaGUI 1.1 GetEntry method

Postby airsoftsoftwair » Thu Aug 10, 2017 7:18 pm

Code: Select all
- Fix [Win32/Linux/MacOS]: Treeview.GetEntry() didn't work correctly for nodes which were empty
User avatar
airsoftsoftwair
 
Posts: 2283
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany


Return to Hollywood bugs

Who is online

Users browsing this forum: No registered users and 3 guests