Listview Change color on an item

tdocs2

Well-Known Member
Licensed User
Longtime User
Greetings from Newbie or Junior.

I have a listview. I want the user to do multiple selections on the listview. I want the user's selections to appear a in a different text color.

I have looked into RichStrings and the SPListview including the sample program written by Graham... Some help, but could not find how to do what I want to do (see above).

Can anyone help?

Thanks in advance.

PS: I noticed that the RichStrings library is part of the documentation for B4A, but the SPListview is not. Any reason for this? I want to stay within the boundaries of B4A "approved" libraries.
 

NJDude

Expert
Licensed User
Longtime User
I don't think that's possible using a ListView, you will have to use panels and a ScrollView to achieve someting like that.

Regarding the "approved" libraries, there are basically 2 kinds, "official" and "user created", the first ones are included with B4A the second ones are made by members of the community and supported by their respective authors.
 
Upvote 0

tdocs2

Well-Known Member
Licensed User
Longtime User
Listview Responses

Thank you, NJ and Klaus.

My listview is variable length and can reach 31,000 items which Listview supports fine. Would scrollview be capable of supporting 31K (max) items - text only of variable length from 25 words to 500?

Very gratetful.

Sandy
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Thank you, NJ and Klaus.

My listview is variable length and can reach 31,000 items which Listview supports fine. Would scrollview be capable of supporting 31K (max) items - text only of variable length from 25 words to 500?

Very gratetful.

Sandy

31,000 records? I still think that a scrollview is good as long as you decide to show portions of your records, instead of the whole list. After all, isn't this what happens in phpAdmin and many other utilities? A textbox for searching would also help. Anyway, as Klaus just said, there are alternatives for such big lists.
 
Upvote 0

tdocs2

Well-Known Member
Licensed User
Longtime User
Thank u Klaus

Thank u Klaus.

I think I am going to try the Table...

Can I dynamically (when user clicks on it) change the text color using what tool?

Thanks again.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Currently when the user clicks on a line it is highlighted.
It wouldn't be difficult to also highlight an individual cell.

Are you sure that the user will scroll over about 30000 items in the list.
I would get angry.
As mc73 already suggested, you should add some preselection to minimize the amount of items in the list.

Best regards.
 
Upvote 0

tdocs2

Well-Known Member
Licensed User
Longtime User
Thanks again

Greetings, Klaus, and thank u again.

My thanks to MC also.

This is a search screen for very large texts. The user can enter a broad search criteria because he is trying to narrow his search but is looking for hints. In my testing, the maximum hits could be a little over 31,000. The screen displays the number of items on the list so the user can make intelligent choices. The user will never look thru the 31K hits, but the fact that he received 31K hits may be of value to him.

The user will have the means to narrow the search thru a step wise refinement process of the search criteria.

The listview is a very fast view and I get immediate results in any of my tablets or phone (I am only testing with Android 4 and higher). It is just too bad than on the event itemclick, that I do not have a property or method to change the color of the text of the item.

The table class is also quick and able to display large selections, but as a newbie, I have a little difficulty following it to adapt it to the bare requirement I need - just change the color of the item clicked.

The SPlistview does not seem to have events.... And I have seen Graham's Richstring and SPListview program sample, but once more SPlistview does not have events like Listview.

I consider myself a pragmatic software developer for applications but not a true computer and software scientist as I would classify yourself, Erel, Graham, NJDude, VB1992, MC, Margret, and some others (those left out is by lack of memory not your achievements and contributions - my apologies) who are brilliant as demonstrated by your logic, knowledge and contributions.

The highest ranking that I expect to achieve is Knows the Basics and not for a long time. And this is a true assesment and not false humility or exaggerated praise of those mentioned above.

Thank you all for giving of yourselves.

Best regards.

Sandy
 
Upvote 0

citywest

Member
Licensed User
Longtime User
Hi Sandy,

You can do this. I know because I do it myself with some large data sets around the sizes you are talking about.

Basically you take advantage of of the fact that a list view has three line types - AddSingleLine, AddTwoLines and AddTwoLinesAndBitmap2.

You style two types differently. Change the text color perhaps add a background gradient, maybe a bitmap to signify selected etc.

Then you set up a list or array to hold the selected item positions. On the ItemClick event add the new item to the list/array and redisplay the listview. For those items not in your list/array you might set them up as a AddSingleLine and those in the list/array AddTwoLines.

The Listview is fast enough on a decent device that the redisplay is unnoticeable.

Regards,

Mark S.
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
Hi Sandy,
Here you find a version of the Table class with highlighting of the selected cell.

I don't consider myself as a computer and software scientist but more as you a software developer for applications.
I am a mecanical engeneer, now retired, and all programs I have written previously were applications I used in my job and now I do it for my pleasure.

Best regards.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…