B4J Question CLVSelections - Crashing When CLV Changes

cklester

Well-Known Member
Licensed User
I've got a clv_Placeholder item into which I build various xCustomListViews, depending on the user's selection.

When I switch between them, I get a crash because (it seems) some index is not being reset. I'm not sure how to inform CLVSelections that the xCustomListView has changed. I've tried Refresh, Initialize, Clear, etc...

In the attached project, click the "Meeting Notes" button from the main page. Click "Set One." Select any item with index > 1. Click "Set Two." Click either item. Crash.

If you select items in "Set One" with index 0 or 1, selecting an item in "Set Two" does not crash.

I guess it's crashing because the index from the prior xCLV is still set at an index that is higher than any index in Set Two, and it must be trying to access it at that index for some reason.

How do I properly switch between xCLVs with CLVSelections and avoid this crash?
 

Attachments

  • clvs_crash.zip
    16.4 KB · Views: 205

cklester

Well-Known Member
Licensed User
Thanks, @Erel ! That was simple.

I didn't try the Clear in that order.

What's going on there? What does the CS2.Clear actually do?
 
Upvote 0

cklester

Well-Known Member
Licensed User
It clears the selection. Without clearing it there could be a discrepancy between CLVSelection state and the underlying CLV.

Yeah, that makes a lot of sense. Not sure why I didn't catch on... :-/

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