Hello ,
i would like add entries (names of file) of a listview (lv1 for example) of RAPAGui in a variable (a$ for example)
Example:
File1
File2
File3
etc.
a$ = File1 .. File2 .. File3 .. etc.
How to do that please ?
Thanks a lot!
Writes entries of a lister in a variable
Re: Writes entries of a lister in a variable
add it where?
if it strings (names) e.g "Calculator" "GoldED" you can with double dots as said
if it strings (names) e.g "Calculator" "GoldED" you can with double dots as said
Code: Select all
Filename1$ = "Calculator"
Filename2$ = "GoldED"
all$ = Filename1$..Filename2$ ;all$ now is "CalculatorGoldED"
Christos
Re: Writes entries of a lister in a variable
Sorry, i would like say from a "listview" and not "of" maybe.
I add file names in a listview with drag'n drop but i don't know how to write names of each entry in a variable like the example.
My code for the drag'drop is:
I add file names in a listview with drag'n drop but i don't know how to write names of each entry in a variable like the example.
My code for the drag'drop is:
Code: Select all
Function p_EventFunc(msg)
Switch msg.Action
Case "Ragagui"
Switch msg.Attribute
Case "DropFile"
For local k = 0 to ListItems(msg.triggervalue)-1
f$ = msg.triggervalue[k]
moai.domethod("lv1", "insert", bottom", f$)
Next
Endswitch
Endswitch
Endfunction
Re: Writes entries of a lister in a variable
Why dont you keep names when you get from event "DropFile"
Simultaneously to a variable AND additional insert it to listview
If, on the other hand, you point is to read listview entries you use GetEntry
https://www.hollywood-mal.com/docs/html ... Entry.html
Simultaneously to a variable AND additional insert it to listview
If, on the other hand, you point is to read listview entries you use GetEntry
https://www.hollywood-mal.com/docs/html ... Entry.html
Christos
Re: Writes entries of a lister in a variable
Yeah, you'll have to GetEntry for all items in the listview and process that data.
Another option would be to use tables, and then you have data of the the whole listview in similar indexed way like in the listview, but in a table when it might be easier to proces or save etc without needing to get data from the listview all the time.
Another option would store the data (filenames in this case) in two places, both in a global table and in the listview, but then you have to remember to add/remove/rename/arrange the data in both places, or render listview always according the table. This might be too complex for simple programs/data, but at some point when you do more complex programs, it might become handy to store data in a table with sub-tables when you can store more information for each item (more than is shown in the listview, for internal usage).
Code: Select all
Local a$ = ""
; Go through all entries in the listiview, index numbers start from 0, so from 0 to total entries minus one
For Local i = 0 To moai.Get("lv1", "Entries") - 1
; Get entry data for each index number into a local temp variable
Local name$ = moai.DoMethod("lv1", "GetEntry", i)
; Process that data somehow, in this case just add it to another variable (a$)
a$ = a$ .. name$
Next
ConsolePrint(a$)
Another option would be to use tables, and then you have data of the the whole listview in similar indexed way like in the listview, but in a table when it might be easier to proces or save etc without needing to get data from the listview all the time.
Code: Select all
Local mytable = {}
; Go through all entries in the listiview, index numbers start from 0, so from 0 to total entries minus one
For Local i = 0 To moai.Get("lv1", "Entries") - 1
; Get entry data for each index number into local temp variable
Local name$ = moai.DoMethod("lv1", "GetEntry", i)
; Process that data somehow, in this case just add it into a table
InsertItem(mytable, name$)
Next
; When you have all items in a table, you can process in in many ways, for example:
Local a$ = Concat(mytable)
ConsolePrint(a$)
; Or add a separator:
a$ = Concat(mytable, ", ")
ConsolePrint(a$)
Another option would store the data (filenames in this case) in two places, both in a global table and in the listview, but then you have to remember to add/remove/rename/arrange the data in both places, or render listview always according the table. This might be too complex for simple programs/data, but at some point when you do more complex programs, it might become handy to store data in a table with sub-tables when you can store more information for each item (more than is shown in the listview, for internal usage).
Re: Writes entries of a lister in a variable
Thanks a lot plouf and jPV for your help, i will test that
Re: Writes entries of a lister in a variable
Work perfectly !
Have a nice day !
Have a nice day !