RapaGUI 1.1 GetEntry method

Report any Hollywood bugs here
Post Reply
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

RapaGUI 1.1 GetEntry method

Post by SamuraiCrow »

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
I'm on registered MorphOS using FlowStudio.
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: RapaGUI 1.1 GetEntry method

Post by SamuraiCrow »

Reduced images:
Image
Image
I'm on registered MorphOS using FlowStudio.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: RapaGUI 1.1 GetEntry method

Post by airsoftsoftwair »

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()?
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: RapaGUI 1.1 GetEntry method

Post by SamuraiCrow »

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.
I'm on registered MorphOS using FlowStudio.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: RapaGUI 1.1 GetEntry method

Post by airsoftsoftwair »

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

Re: RapaGUI 1.1 GetEntry method

Post by airsoftsoftwair »

Code: Select all

- Fix [Win32/Linux/MacOS]: Treeview.GetEntry() didn't work correctly for nodes which were empty
Post Reply