Listview ItemClick wrong result

CidTek

Active Member
Licensed User
Longtime User
I am getting the same data as Position in the Value field eg: 0, 1, 2 or 3 etc.
 

agraham

Expert
Licensed User
Longtime User
That is the default unless you explicitly set a return value using one of the AddxxxLine2() methods.

Edit: :sign0013: Actually I may be wrong here, I think the displayed text may be the default.

Edit: Yup wrong! Just knocked up a quick test and I get the text value as a default. Are you sure you are not setting the values explicitly?
 
Last edited:
Upvote 0

CidTek

Active Member
Licensed User
Longtime User
That is the default unless you explicitly set a return value using one of the AddxxxLine2() methods.

Edit: :sign0013: Actually I may be wrong here, I think the displayed text may be the default.

When I first built a skinny version of my app with dummy data displaying in the Listview, it always returned the first line of text in the Value field. Recently that changed. Could it be a bug in the update?
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
ListView returns by default the Text of the first line.
Or using one of the following Methods AddSingleLine2, AddTwoLines2 or AddTwoLinesAndBitmap2 allows to define the return value, with these you can return more information than just with the text of the first line.

Best regards.
 
Upvote 0

CidTek

Active Member
Licensed User
Longtime User
ListView returns by default the Text of the first line.
Or using one of the following Methods AddSingleLine2, AddTwoLines2 or AddTwoLinesAndBitmap2 allows to define the return value, with these you can return more information than just with the text of the first line.

Best regards.

But it isn't returning text by default in my case.

This is how I populate the listview
ListView1.AddTwoLines2(Cursor.GetString("stop_code") & " " & Cursor.GetString("stop_name"), (Round2( 100 * Sqrt(Cursor.GetString("DistanceSquared")),2)) & " km", i)

If I just do this then it works.
ListView1.AddTwoLines("Route 12","Stop 1134 20m")
 
Upvote 0

CidTek

Active Member
Licensed User
Longtime User
You ARE explicitly setting the return value as you are using AddTwoLines2() and not AddTwoLines().

ListView1.AddTwoLines2(Cursor.GetString("stop_code ") & " " & Cursor.GetString("stop_name"), (Round2( 100 * Sqrt(Cursor.GetString("DistanceSquared")),2)) & " km", i)

Oops you're right. Thanks!!!
 
Upvote 0
Top