Page 2 of 2

Re: Treeview and XML

Posted: Fri Jan 26, 2024 5:42 pm
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?

Re: Treeview and XML

Posted: Sun Jan 28, 2024 12:45 pm
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.

Re: Treeview and XML

Posted: Sun Jan 28, 2024 1:50 pm
by papiosaur
Thanks a lot Andreas!

Re: Treeview and XML

Posted: Sun Jan 28, 2024 3:44 pm
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.

Re: Treeview and XML

Posted: Mon Jan 29, 2024 1:10 pm
by papiosaur
Tested on AROS, unfortunally there is no object recognized, show "Nil" on first click on an entry.

Re: Treeview and XML

Posted: Sun Feb 04, 2024 10:09 pm
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.

Re: Treeview and XML

Posted: Mon Feb 05, 2024 12:03 pm
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?

Re: Treeview and XML

Posted: Mon Feb 05, 2024 6:41 pm
by emeck
I think this is the same as reported here .

Re: Treeview and XML

Posted: Mon Feb 05, 2024 9:26 pm
by papiosaur
Maybe my other thread could help to understand:

viewtopic.php?p=20298

Re: Treeview and XML

Posted: Tue Aug 13, 2024 10:17 pm
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.