Treeview and XML

Discuss GUI programming with the RapaGUI plugin here
papiosaur
Posts: 161
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: 5446
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: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Treeview and XML

Post by papiosaur »

Thanks a lot Andreas!
papiosaur
Posts: 161
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: 161
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: 5446
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: 604
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: 169
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.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE
papiosaur
Posts: 161
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
Post Reply