Feb 26, 2020 Replies: 6 This class extends xCustomListView library and adds more selection modes: MODE_SINGLE_ITEM_TEMP - The same as the default behavior. MODE_SINGLE_ITEM_PERMANENT - Single item is selected and the selection remains. MODE_MULTIPLE_ITEMS- Multiple items can be selected. There is also a helper method that selects an item and makes it visible. Usage: Initialize a CLVSelections object and set the selection mode: Code: Copy CSelections.Initialize(CustomListView1) CSelections.Mode = CSelections.MODE_MULTIPLE_ITEMS Implement the ItemClick event: Code: Copy Sub CustomListView1_ItemClick (Index As Int, Value As Object) CSelections.ItemClicked(Index) End Sub If using lazy loading then also call from VisibleRangeChanged (at the end): Code: Copy CSelections.VisibleRangeChanged(FirstIndex, LastIndex) Depends on B4XCollections, xCustomListView and XUI libraries. B4J example is attached. The class is included inside. Attachments CLVSelections.zip CLVSelections.zip 3.8 KB · Views: 1,798 Click to expand...
This class extends xCustomListView library and adds more selection modes: MODE_SINGLE_ITEM_TEMP - The same as the default behavior. MODE_SINGLE_ITEM_PERMANENT - Single item is selected and the selection remains. MODE_MULTIPLE_ITEMS- Multiple items can be selected. There is also a helper method that selects an item and makes it visible. Usage: Initialize a CLVSelections object and set the selection mode: Code: Copy CSelections.Initialize(CustomListView1) CSelections.Mode = CSelections.MODE_MULTIPLE_ITEMS Implement the ItemClick event: Code: Copy Sub CustomListView1_ItemClick (Index As Int, Value As Object) CSelections.ItemClicked(Index) End Sub If using lazy loading then also call from VisibleRangeChanged (at the end): Code: Copy CSelections.VisibleRangeChanged(FirstIndex, LastIndex) Depends on B4XCollections, xCustomListView and XUI libraries. B4J example is attached. The class is included inside.
GeoT Active Member Licensed User Longtime User Feb 14, 2023 #2 Hello. I attach the B4A version of this class. Regards. Attachments CLVSelections.zip CLVSelections.zip 5.4 KB · Views: 750
LucaMs Expert Licensed User Longtime User Aug 8, 2024 #3 Erel, I made a couple of changes to this class of yours: B4X: Copy 'v1.00 'v.1.10 (lm) Added selection of a single permanent item by pressing the arrow keys (B4J) ' and the CLV scrolling required for the selected item to be fully visible. (I hope the comment above is exhaustive). I am sure that I have not compromised your code and that my version is compatible with yours. You can easily find my changes (mostly (maybe only) Subs/Lines added) by searching: B4X: Copy 'LM - 08/08/2024 I would much rather you post mine as your own than for me to rename the class and post it (please read this). [BTW These changes were much less simple than I imagined; or, more likely, I just got too old ? ] Last edited: Aug 8, 2024
Erel, I made a couple of changes to this class of yours: B4X: Copy 'v1.00 'v.1.10 (lm) Added selection of a single permanent item by pressing the arrow keys (B4J) ' and the CLV scrolling required for the selected item to be fully visible. (I hope the comment above is exhaustive). I am sure that I have not compromised your code and that my version is compatible with yours. You can easily find my changes (mostly (maybe only) Subs/Lines added) by searching: B4X: Copy 'LM - 08/08/2024 I would much rather you post mine as your own than for me to rename the class and post it (please read this). [BTW These changes were much less simple than I imagined; or, more likely, I just got too old ? ]
Erel B4X founder Staff member Licensed User Longtime User Aug 8, 2024 #4 I don't see your file, however it is better that you post it as a different class / library with its own name.
I don't see your file, however it is better that you post it as a different class / library with its own name.
LucaMs Expert Licensed User Longtime User Aug 8, 2024 #5 Erel said: I don't see your file Click to expand... I have not attached it, waiting for your answer. I do not think it is better for me to publish it with a different name, having N very similar classes creates embarrassment in the choice and the official ones (i.e. yours) are trusted more. Anyway, I will do as you say, if you do not change your opinion.
Erel said: I don't see your file Click to expand... I have not attached it, waiting for your answer. I do not think it is better for me to publish it with a different name, having N very similar classes creates embarrassment in the choice and the official ones (i.e. yours) are trusted more. Anyway, I will do as you say, if you do not change your opinion.
Erel B4X founder Staff member Licensed User Longtime User Aug 8, 2024 #6 As I see it (and it is perfectly fine that you see it differently), this is just a small utility. There is nothing bad with having another small and similar utility. And if I add it to this class then I need to fully understand the code and I need to maintain it. As you wrote this is not a trivial change.
As I see it (and it is perfectly fine that you see it differently), this is just a small utility. There is nothing bad with having another small and similar utility. And if I add it to this class then I need to fully understand the code and I need to maintain it. As you wrote this is not a trivial change.
LucaMs Expert Licensed User Longtime User Aug 8, 2024 #7 Erel said: As I see it (and it is perfectly fine that you see it differently), this is just a small utility Click to expand... I would add all CLV expansion classes to CLV itself I understand, however, that you should spend (waste) time reviewing the changes made.
Erel said: As I see it (and it is perfectly fine that you see it differently), this is just a small utility Click to expand... I would add all CLV expansion classes to CLV itself I understand, however, that you should spend (waste) time reviewing the changes made.