Use Pageview class with Treeview class ?

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

Use Pageview class with Treeview class ?

Post 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
User avatar
airsoftsoftwair
Posts: 5405
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Use Pageview class with Treeview class ?

Post by airsoftsoftwair »

Sure it is. Just set Pageview.Active to the desired page whenever the user clicks a treeview item.
papiosaur
Posts: 149
Joined: Fri Mar 31, 2023 1:34 pm

Re: Use Pageview class with Treeview class ?

Post 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 ;-)
papiosaur
Posts: 149
Joined: Fri Mar 31, 2023 1:34 pm

Re: Use Pageview class with Treeview class ?

Post 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!
User avatar
airsoftsoftwair
Posts: 5405
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Use Pageview class with Treeview class ?

Post 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
papiosaur
Posts: 149
Joined: Fri Mar 31, 2023 1:34 pm

Re: Use Pageview class with Treeview class ?

Post 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.
papiosaur
Posts: 149
Joined: Fri Mar 31, 2023 1:34 pm

Re: Use Pageview class with Treeview class ?

Post 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.
User avatar
jPV
Posts: 588
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Use Pageview class with Treeview class ?

Post 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.
User avatar
airsoftsoftwair
Posts: 5405
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Use Pageview class with Treeview class ?

Post 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.
Post Reply