Page 1 of 2

Use Pageview class with Treeview class ?

Posted: Sat Jan 27, 2024 11:26 am
by papiosaur
Hello,

i would like to do a GUI with a treeview on the left and pageview class on the right.

i would like to open a new page for each treeview entry.

Is possible?

Thanks for your answer

Re: Use Pageview class with Treeview class ?

Posted: Sun Jan 28, 2024 12:47 pm
by airsoftsoftwair
Sure it is. Just set Pageview.Active to the desired page whenever the user clicks a treeview item.

Re: Use Pageview class with Treeview class ?

Posted: Sun Jan 28, 2024 2:03 pm
by papiosaur
Thanks Andreas!

My problem was the creation of this new group.
I have inserted a new vertical group "Pageview" after the Treeview group and it work fine!

I can start now ;-)

Re: Use Pageview class with Treeview class ?

Posted: Sun Jan 28, 2024 2:57 pm
by papiosaur
I have a problem to open a specific page when i click on specific entry of the treeview...

Do you have an example please?

Thanks!

Re: Use Pageview class with Treeview class ?

Posted: Sun Feb 04, 2024 10:09 pm
by airsoftsoftwair
papiosaur wrote: Sun Jan 28, 2024 2:57 pm Do you have an example please?
Here you go:

Code: Select all

@REQUIRE "RapaGUI"

Function p_EventFunc(msg)

	If (msg.attribute = "Active") And StartsWith(msg.triggervalue, "item") Then moai.Set("pv", "active", Val(UnrightStr(msg.triggervalue, 4)) - 1) 
			
EndFunction

xml$ = [[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
					
	<window id="win" title="Tasks" height="400" width="400">
		<vgroup>
			<hgroup>
				<treeview id="tv" height="250" notify="active">
					<column title="Column"/>
					
					<node id="tasks" name="My Tasks" >
						<leaf id="item1">
							<item>One</item>
						</leaf>
						<leaf id="item2">
							<item>Two</item>
						</leaf>
						<leaf id="item3">
							<item>Three</item>
						</leaf>					
					</node>
				</treeview>
				<pageview id="pv">
					<vgroup title="Page 1">
				       		<listview>
				          		<column>
				             			<item>Entry</item>
				          		</column>
				       		</listview>
				   	</vgroup>
				   	<vgroup title="Page 2">
				       		<texteditor/>
				   	</vgroup>
				   	<vgroup title="Page 3">
				       		<button id="btn">Click me</button>
				   	</vgroup>
				</pageview>
			</hgroup>						
		</vgroup>
	</window>
</application>
]]

moai.CreateApp(xml$)

InstallEventHandler({RapaGUI = p_EventFunc})

; main loop!
Repeat
	WaitEvent
Forever

Re: Use Pageview class with Treeview class ?

Posted: Mon Feb 05, 2024 9:23 pm
by papiosaur
Thanks a lot Andreas!

Just tested and it confirm my problem with Treeview on MorphOS on this thread:

viewtopic.php?t=3878

This is a snapshot:

Image

Seems first line of the Treeview is "Off"

When i execute the code, i get "Entry" page.

If i click on "Two" entry then "Three" entry i get "TextEditor", Hollywood show the page of the previous item each time...

I hope it could help you.

Re: Use Pageview class with Treeview class ?

Posted: Tue Feb 06, 2024 9:05 am
by papiosaur
By testing more, if there is only 1 column, i have the graphic bug, if 2 columns are sets, the show is correct.

Re: Use Pageview class with Treeview class ?

Posted: Tue Feb 06, 2024 3:21 pm
by jPV
papiosaur wrote: Tue Feb 06, 2024 9:05 am By testing more, if there is only 1 column, i have the graphic bug, if 2 columns are sets, the show is correct.
I also had the graphical bug on the treeview titles with a single column example code. It shows underlaying windows/desktop where it should show the title.. and then it flickers with random graphic data when you resize the window. The same thing that can be seen in the above screenshot.

Re: Use Pageview class with Treeview class ?

Posted: Sun Feb 11, 2024 9:54 pm
by airsoftsoftwair
jPV wrote: Tue Feb 06, 2024 3:21 pm I also had the graphical bug on the treeview titles with a single column example code. It shows underlaying windows/desktop where it should show the title.. and then it flickers with random graphic data when you resize the window. The same thing that can be seen in the above screenshot.
Yeah, but that is clearly a MUI bug. RapaGUI doesn't do any drawing at all, this is all done by MUI. So that title thing is a MUI bug, the wrong entry that is returned is likely a RapaGUI bug. Even though it works on OS3, I have an idea what could be causing this on MorphOS. I'll check.

Re: Use Pageview class with Treeview class ?

Posted: Tue Aug 13, 2024 10:19 pm
by airsoftsoftwair
papiosaur wrote: Mon Feb 05, 2024 9:23 pm Seems first line of the Treeview is "Off"

When i execute the code, i get "Entry" page.

If i click on "Two" entry then "Three" entry i get "TextEditor", Hollywood show the page of the previous item each time...
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