Treeview and XML

Discuss GUI programming with the RapaGUI plugin here
papiosaur
Posts: 213
Joined: Fri Mar 31, 2023 1:34 pm

Re: Treeview and XML

Post by papiosaur »

Now, i understand better my problem in EasyRapa 1.1 (MorphOS) when i want edit the menu...it give me an error...

I have report the problem to the author but seems it's a problem with RapaGui for MorphOS (maybe other Amiga platforms).

The menu edition work on other platforms?

Maybe the edition is not supported by MUI?

Andreas, an idea?
User avatar
airsoftsoftwair
Posts: 5626
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Treeview and XML

Post by airsoftsoftwair »

I'm afraid editing treeview items is currently broken in RapaGUI's MUI backend so it won't work on MorphOS or AmigaOS. But it's really a mystery because everything is implemented but it doesn't work. I don't know why I didn't notice this when I wrote the code. I surely must have tested it?! Anyway, will be fixed.
papiosaur
Posts: 213
Joined: Fri Mar 31, 2023 1:34 pm

Re: Treeview and XML

Post by papiosaur »

Thanks a lot Andreas!
papiosaur
Posts: 213
Joined: Fri Mar 31, 2023 1:34 pm

Re: Treeview and XML

Post by papiosaur »

A very strange thing:

If i use this lines when i click on a treeview entry:

aa=moai.get("xml", "active")
ConsolePrint(aa)

i get value "Off" if i click on an entry of the treeview, if i click on another entry i get the name of the previous entry, etc.

I think the problem is here.
papiosaur
Posts: 213
Joined: Fri Mar 31, 2023 1:34 pm

Re: Treeview and XML

Post by papiosaur »

Tested on AROS, unfortunally there is no object recognized, show "Nil" on first click on an entry.
User avatar
airsoftsoftwair
Posts: 5626
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Treeview and XML

Post by airsoftsoftwair »

This works here:

Code: Select all

@REQUIRE "RapaGUI"

Function p_EventFunc(msg)

	If msg.attribute = "Active" Then DebugPrint(msg.triggervalue)
			
EndFunction

xml$ = [[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
					
	<window id="win" title="Tasks" height="400" width="400">
		<vgroup>
			<treeview id="tv" height="250" notify="active">
				<column title="first "/>
				<column title="Second"/>
				
				<node id="tasks" name="My Tasks" >
					<node id="open" name="Open Tasks" >
			
					</node>	
				</node>
			</treeview>
	
		</vgroup>
	</window>
</application>
]]

moai.CreateApp(xml$)

InstallEventHandler({RapaGUI = p_EventFunc})

moai.DoMethod("tv", "open", "root", True)
;Open Tasks
moai.DoMethod("tv", "insertleaf", 0 , "open", "Tail", "1-1", "1-2" )
moai.DoMethod("tv", "insertleaf", 1 , "open", "Tail", "1-2","2-2")

; main loop!
Repeat
	WaitEvent
Forever 
It correctly prints the item that has been clicked. Tested on OS3.
User avatar
jPV
Posts: 675
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Treeview and XML

Post by jPV »

airsoftsoftwair wrote: Sun Feb 04, 2024 10:09 pm This works here:

Code: Select all

@REQUIRE "RapaGUI"

Function p_EventFunc(msg)

	If msg.attribute = "Active" Then DebugPrint(msg.triggervalue)
			
EndFunction

xml$ = [[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
					
	<window id="win" title="Tasks" height="400" width="400">
		<vgroup>
			<treeview id="tv" height="250" notify="active">
				<column title="first "/>
				<column title="Second"/>
				
				<node id="tasks" name="My Tasks" >
					<node id="open" name="Open Tasks" >
			
					</node>	
				</node>
			</treeview>
	
		</vgroup>
	</window>
</application>
]]

moai.CreateApp(xml$)

InstallEventHandler({RapaGUI = p_EventFunc})

moai.DoMethod("tv", "open", "root", True)
;Open Tasks
moai.DoMethod("tv", "insertleaf", 0 , "open", "Tail", "1-1", "1-2" )
moai.DoMethod("tv", "insertleaf", 1 , "open", "Tail", "1-2","2-2")

; main loop!
Repeat
	WaitEvent
Forever 
It correctly prints the item that has been clicked. Tested on OS3.
This doesn't work correctly on MorphOS here either (haven't tested elsewhere). I get this when I click all tree items from top to bottom ("My Tasks", "Open Tasks", "1-1...", and "1-2..."):

Ram Disk:> hollywood -quiet rapatree.hws
Off
tasks
open
0

So, like msg.TriggerValue would be lagging by one.


Then I converted the tree to MUIRoyale:

Code: Select all

@REQUIRE "MUIRoyale"

Function p_EventFunc(msg)

	If msg.attribute = "Active" Then DebugPrint(msg.triggervalue)
			
EndFunction

xml$ = [[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
					
	<window id="win" title="Tasks" height="400" width="400">
		<vgroup>
			<listtree id="tv" notify="active">
				<node id="tasks" name="My Tasks" >
					<node id="open" name="Open Tasks" >
			
					</node>	
				</node>
			</listtree>
	
		</vgroup>
	</window>
</application>
]]

mui.CreateGUI(xml$)

InstallEventHandler({MUIRoyale = p_EventFunc})

mui.DoMethod("tv", "open", "root", "all")
;Open Tasks
mui.DoMethod("tv", "Insert", "1-1", 0, "open", "Tail", "")
mui.DoMethod("tv", "Insert", "1-2", 1, "open", "Tail", "")

; main loop!
Repeat
	WaitEvent
Forever 
And now the output is:

Ram Disk:> hollywood -quiet muitree.hws
tasks
open
0
1

So, by using MUIRoyale it works as expected and the issue is unlikely to be in the MUI implementation but rather in RapaGUI?
User avatar
emeck
Posts: 187
Joined: Fri Apr 03, 2015 3:17 pm

Re: Treeview and XML

Post by emeck »

I think this is the same as reported here .
PowerBook 5.8 MorphOS 3.18
Mac Mini MorphOS 3.18
papiosaur
Posts: 213
Joined: Fri Mar 31, 2023 1:34 pm

Re: Treeview and XML

Post by papiosaur »

Maybe my other thread could help to understand:

viewtopic.php?p=20298
User avatar
airsoftsoftwair
Posts: 5626
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Treeview and XML

Post by airsoftsoftwair »

jPV wrote: Mon Feb 05, 2024 12:03 pm This doesn't work correctly on MorphOS here either (haven't tested elsewhere). I get this when I click all tree items from top to bottom ("My Tasks", "Open Tasks", "1-1...", and "1-2..."):

Ram Disk:> hollywood -quiet rapatree.hws
Off
tasks
open
0

So, like msg.TriggerValue would be lagging by one.
So actually this is a bug in MorphOS MUI. I already reported it to them back in May 2021 but in December 2021 they said they won't fix it for fear of breaking existing apps. So I've now added a workaround specifically for MorphOS to RapaGUI:

Code: Select all

- Change [MorphOS]: Added a workaround for a bug in MorphOS' listtree class that caused notifications on
  Listtree.Active to return the wrong items
jPV wrote: Mon Feb 05, 2024 12:03 pm Then I converted the tree to MUIRoyale:
So, by using MUIRoyale it works as expected and the issue is unlikely to be in the MUI implementation but rather in RapaGUI?
Nope, MUI Royale uses a different notification mechanism which is not as precise as RapaGUI's. In MUI Royale notifications are not immediately handled, just like it was in RapaGUI 1.x. Since RapaGUI 2.x, however, notification callbacks are immediately handled when events occur and that's when the off-by-one bug in MorphOS' Listtree.mcc shows.
Post Reply