View previous topic :: View next topic |
Author |
Message |
DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Tue Sep 17, 2013 11:19 am Post subject: How to get text of subitems |
|
|
Hey there,
How can I get the text of subitems of an listitem object? (In ListView).
Code: | function Data:PraseData(Table)
-- few steps before..
for i=#Table,1,-1 do -- appending from the last to the first, since there's no autoscroll in ListView
self[2][i] = {};
self[2][i][1] = self.ListVI.add();
self[2][i][1].Caption = Table[i][1];
self[2][i][2] = self[2][i][1].getSubItems();
self[2][i][2].cul1 = self[2][i][2].add("String1"); --Not the actual string, just as a example
self[2][i][2].cul2 = self[2][i][2].add("String2"); --Not the actual string, just as a example
end
-- few steps after..
end |
Doing
Code: | print(Data[2][1][2].Text)
--> String1 String2 |
Doing
Code: | local a,b = Data[2][1][2].Text
print(a)
--> String1 String2
print(b)
--> nil |
How can I obtain for example only String1?
without having to write a script to separate both strings. _________________
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Tue Sep 17, 2013 11:34 am Post subject: |
|
|
SubItems is a Strings object
Code: |
Strings Class: (Inheritance : Object) (Mostly an abstract class)
properties
Text : String - All the strings in one string
Count: Integer - The number of strings in this list
String[]: String - Array to access one specific string in the list
[] = String[]
methods
clear() : Deletes all strings in the list
add(string) : adds a string to the list
delete(index) : Deletes a string from the list
getText() : Returns all the strings as one big string
setText() : Sets the strings of the given strings object to the given text (can be multiline)
indexOf(string): Returns the index of the specified string. Returns -1 if not found
insert(index, string): Inserts a string at a specific spot moving the items after it
getCount(): Returns the number is strings in the list
remove(string); Removes the given string from the list
loadFromFile(filename) : Load the strings from a textfile
saveToFile(filename) : Save the strings to a textfile
getString(index) : gets the string at the given index
setString(index, string) : Replaces the string at the given index
|
the Text property returns all the strings in one line
You want to use the line specific one
either [] or String[] or getString()
not sure if I fixed [] in the release but try
Code: |
print(Data[2][1][2][0])
|
else
Code: |
print(Data[2][1][2].String[0])
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Tue Sep 17, 2013 1:25 pm Post subject: |
|
|
Thanks for reply.
This
Code: |
print(Data[2][1][2].String[0]) |
Worked, thanks again man. _________________
|
|
Back to top |
|
|
|