Open JSON database with doubleclick on a treeview entry

Find quick help here to get you started with Hollywood
Post Reply
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Open JSON database with doubleclick on a treeview entry

Post by papiosaur »

Hello all,

i can create an "action" when i doubleclick on a treeview entry but it's the same for all the entries of the treeview.

I would like to open a specific file (a json database for a listview) when i doubleclick on a specif entry of the treeview.

Is possible please ?

For the moment my part of code is :

Code: Select all

Switch msg.action
    Case "RapaGUI"
         Switch msg.Attribute
              Case "DoubleClick"
                    Switch msg.id
                         Case "treeview"
                                "action"

When i replace "treeview" by the name of my specific entry (ex: Games), it doesn't work.

i hope is possible :-)

Thanks for your help.
plouf
Posts: 470
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Open JSON database with doubleclick on a treeview entry

Post by plouf »

first some nagging ;)
you have created at least 2 topics with irregular topic, just trying to get get help inanother topic
this topic AND the previous has nothing to do with your problem, you problem is "how to find the active listview entry"
also there is no such think as "json database", where and ho you use it inside hollywood ?

here s an example of your practically query to "how to get active entry"

Code: Select all

@REQUIRE "RapaGUI"

xml$ = [[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app" useicons="true">
	<window title="listview" width="500" height="320" id="win" defaultobject="listview1">
		<vgroup>
			<listview id="listview1" forcemode="dataview">
				<column title="column1" id="col1">
					<item>One</item>
					<item>Two</item>
					<item>Three</item>
				</column>
				<column title="column2" id="col2">
					<item>One2</item>
					<item>Two2</item>
					<item>Three2</item>
				</column>
			</listview>
		</vgroup>
	</window>
</application>
]]
moai.CreateApp(xml$)

Function p_EventFunc(msg)
	If msg.Attribute = "DoubleClick"
		DebugPrint(moai.Get("listview1", "active", True))
	EndIf
EndFunction 
InstallEventHandler({RapaGUI = p_EventFunc})

moai.Notify("listview1","DoubleClick",True)

Repeat
	WaitEvent
Forever

Christos
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Open JSON database with doubleclick on a treeview entry

Post by papiosaur »

Hello plouf,

my problem is about the "treeview", not the "listview".

About JSON, Hollywood support it and can be loaded and saved in a "listview" with the same number of column than JSON entries.
plouf
Posts: 470
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Open JSON database with doubleclick on a treeview entry

Post by plouf »

tree example

Code: Select all

@REQUIRE "RapaGUI"

xml$ = [[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app" useicons="true">
	<window title="listview" width="500" height="320" id="win" >
		<vgroup>
			<treeview id="tree">
			   <column/>
			   <node name="CPU">
			      <leaf id="model"><item >Model: Motorola MPC 7447 Apollo V1.1</item></leaf>
			      <leaf id="cpu"><item>CPU speed: 999 Mhz</item></leaf>
			      <leaf id="fsb"><item>FSB speed: 133 Mhz</item></leaf>
			      <leaf id="ext"><item>Extensions: performancemonitor altivec</item></leaf>
			   </node>
			   <node name="Machine">
			      <leaf id="machine"><item>Machine name: Pegasos II</item></leaf>
			      <leaf id="memory"><item>Memory: 524288 KB</item></leaf>
			      <leaf id="bus"><item>Extensions: bus.pci bus.agp</item></leaf>
			   </node>
			</treeview>
		</vgroup>
	</window>
</application>
]]
moai.CreateApp(xml$)

Function p_EventFunc(msg)
	If msg.Attribute = "DoubleClick"
		DebugPrint(moai.Get("tree", "Active", True))
	EndIf
EndFunction 
InstallEventHandler({RapaGUI = p_EventFunc})

moai.Notify("tree","DoubleClick",True)

Repeat
	WaitEvent
Forever


Christos
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Open JSON database with doubleclick on a treeview entry

Post by papiosaur »

Thanks a lot plouf!

If you need an example of JSON support, you can contact me in pm.
Post Reply