Jump to content
sjordi

ListView styled/platform bug?

Recommended Posts

Posted (edited)

Hi all,

Just spent 3 days pulling my hair trying to understand why a list view is crashing each time I remove the grouping option for iOS.

 

You know, if you set the ListView.ControlType to Platform, add FillHeader + FillBreak in Visual Binding (with custom format as "SubString(%s, 0, 1)"), on iOS you get your list displayed with Alphabetic groups and the nice vertical Alphabet index on the right to quickly navigate in the list. Works fine.

 

Now if I sort my list using another non alphabetical parameter, I have to disable that index first. So I remove the visual binding to the list Headers.

      LinkListControlToField1.FillBreakCustomFormat := '' ;
      LinkListControlToField1.FillBreakFieldName := '' ;
      LinkListControlToField1.FillHeaderFieldName := '';
      LinkListControlToField1.FillHeaderCustomFormat := '' ;

 

Problem is that it crashes each time (also on Android), telling me that the value I pass is "out of range".

It's fine on Windows and macOS.

 

Now I think I found the reason... if I set the ListView.ControlType to "Styled" instead of "Platform", everything is fine, no crash (but no index either on iOS).

As a workaround, I actually switch the ControlType to Styled, remove the links, and set it back to Platform. Of course it's not elegant.

 

Could someone try the attached project and tell me if it crashed too on your side: iOS, iPadOS?

The db is test.sqlite and should normally be deployed to your app.

As-is, it should work.

 

If it works, then try to comment out
   ListView1.BeginUpdate ;
   ListView1.ControlType := TControlType.Styled ;

and 

   ListView1.ControlType := TControlType.Platform ;
   ListView1.EndUpdate ;

in the TForm1.ToolBar1Click procedure.

Does it crash now that you stay in Platform mode instead of Styled?
 

Any idea if I'm doing something wrong or if this is a bug, in which case I will open a bug report at QC (Embarcadero)

 

Thanks for your help.

Steve

 

 

 

 

ListIndexed.zip

Edited by sjordi

Share this post


Link to post

I confirm this crashes on my iPad when those 4 lines are commented out. It's not a terribly inelegant work-around but since the same code doesn't crash on Win/MacOS, it does seem like there's a bug in there.

Share this post


Link to post

Thanks for trying.
I'm opening a bug report 

 

It seems that even if you don't remove any kind of binds, but just update the database content, it is enough to have it crash. Any kind of dataset change would do...

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×