help needed on treeview setitem

Discuss GUI programming with the RapaGUI plugin here
Post Reply
ilbarbax
Posts: 101
Joined: Thu Apr 01, 2010 6:41 pm

help needed on treeview setitem

Post by ilbarbax »

I have a treeview where I prepared a dialog to edit the different fields and when I try to save the updated data only the first field is updated and not the subsequent ones.
Probably I do something wrong. Help please.

This is part of the XML involved:

Code: Select all

					<treeview id="tv" editablenodes="true">
						<column title="Item" editable="true"/>
						<column title="ID" editable="true"/>
						<column title="shortcut" editable="true"/>
						<column title="Help" editable="true"/>
						<column title="Disabled" checkbox="true"/>
This is the code to save the data in the existing field

Code: Select all

					Local a_a=moai.Get("tv", "active")										
					moai.DoMethod(a_a, "SetItem", 0, moai.Get("ptv_Item","text"))					
					moai.DoMethod(a_a, "SetItem", 1, moai.Get("ptv_ID","text"))					
					moai.DoMethod(a_a, "SetItem", 2, moai.Get("ptv_Scut","text"))					
					moai.DoMethod(a_a, "SetItem", 3, moai.Get("ptv_Help","text"))					
					moai.DoMethod(a_a, "SetState", 4, moai.Get("ptv_disab","selected"))

User avatar
airsoftsoftwair
Posts: 4392
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: help needed on treeview setitem

Post by airsoftsoftwair »

Looks correct. Please post a minimal, complete, and verifiable example (MCVE) and I'll take a look.

ilbarbax
Posts: 101
Joined: Thu Apr 01, 2010 6:41 pm

Re: help needed on treeview setitem

Post by ilbarbax »

Here you are

File test1.xml

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<application id="EasyRapa">
		
		
	<window id="win"  width="800" height="600" >
		<vgroup>
			<treeview id="tv" editablenodes="true">
				<column title="Item" editable="true"/>
				<column title="ID" editable="true"/>
				<column title="shortcut" editable="true"/>
				<column title="Help" editable="true"/>
				<column title="Disabled" checkbox="true"/>
				
				<node name="My Menu" id="tv_my_Menu">
					<node name="File" id="mn_n_File">
						<leaf id="mn_i_open">
							<item>Open</item>
							<item>mn_open</item>
							<item>Ctrl+O</item>
							<item>Open a new project</item>
							<item>False</item>
						</leaf>
						<leaf id="mn_i_close">
							<item>Close</item>
							<item>mn_close</item>
							<item></item>
							<item>Close project</item>
							<item>True</item>
						</leaf>						
					</node>
				</node>
			</treeview>
			<hgroup>
				<button id="mn_Ok">Test</button>
			</hgroup>	
			
		</vgroup>
	</window>
File test1.hws

Code: Select all

@REQUIRE "RapaGUI", {Version = 1, Revision = 2}
	
Function p_test(msg)
	Switch msg.action
	Case "RapaGUI":
		Local a_a=moai.Get("tv", "active")										
		moai.DoMethod(a_a, "SetItem", 0, "aaaaa")					
		moai.DoMethod(a_a, "SetItem", 1, "bbbbb")					
		moai.DoMethod(a_a, "SetItem", 2, "ccccc")					
		moai.DoMethod(a_a, "SetItem", 3, "ddddd")					
		moai.DoMethod(a_a, "SetState", 4,True)
	EndSwitch										

	
EndFunction

moai.CreateApp(FileToString("test1.xml"))

InstallEventHandler({RapaGUI = p_test})

Repeat
	 WaitEvent
Forever

User avatar
airsoftsoftwair
Posts: 4392
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: help needed on treeview setitem

Post by airsoftsoftwair »

Thanks, which platforms have you tested this on?

ilbarbax
Posts: 101
Joined: Thu Apr 01, 2010 6:41 pm

Re: help needed on treeview setitem

Post by ilbarbax »

Windows 7 64

User avatar
airsoftsoftwair
Posts: 4392
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: help needed on treeview setitem

Post by airsoftsoftwair »

Right, thanks for reporting this major issue!

Code: Select all

- Fix [Windows/macOS/Linux]: Treeviewleaf.SetItem() was only able to change the text of items in the first column 

Post Reply