Trouble getting values from listview

Discuss GUI programming with the RapaGUI plugin here
Post Reply
Figgy78
Posts: 32
Joined: Wed Oct 11, 2017 9:13 am

Trouble getting values from listview

Post by Figgy78 »

Hi!

I'm trying to fetch a couple of values from a listview.

The listview has two columns: "fermentable" and "grams".
I have entered two test rows:
Row 0: "Fermentable1", "123"
Row 2: "Fermentable2", "234"

Using a button I made I want to write those to a file, so to debug I wrote this code:

Code: Select all

;Add Fermentables to a Table (array)
fermentablesTable = {}
For local a = 0 to (moai.Get("fermentlistview","Entries")-1)
	fermentablesTable[a] = moai.DoMethod("fermentlistview", "GetEntry", a)
	DebugPrint(fermentablesTable[a])		
next
This outputs the following in the Debug window:

Code: Select all

Fermentable1
Fermentable2
So.. Why am I not getting the "grams" column in the debug window? Am I being an idiot? I presume I am. :)

Erlend
p-OS
Posts: 167
Joined: Mon Nov 01, 2010 11:56 pm

Re: Trouble getting values from listview

Post by p-OS »

GetEntry results as many values as you have columns in your listview

Code: Select all

  v_fermentable , v_grams = moai.DoMethod("fermentlistview", "GetEntry", a)
 
Figgy78
Posts: 32
Joined: Wed Oct 11, 2017 9:13 am

Re: Trouble getting values from listview

Post by Figgy78 »

Ahhh.. That's great. Thanks. I think I learned something fundamental just now :)
Post Reply