TAdvResponsiveList clearing the list

If you click on a tile in the list and pick that up with the OnItemClick and say show a modal form. On closing the form you may want to clear the list.  If you do that however you will get an access violation as the mouse up event of the component tries to save the current item index.


I wonder if you could please look at doing this a little differently to prevent the access violation ( see below FItemUp gets destroyed in DoItemClick(FItemUp)



procedure TAdvResponsiveList.MouseUpN({%H-}Button: TMouseButton; {%H-}Shift: TShiftState;
  X, Y: Integer);
var
  FItemUp: TResponsiveListItem;
  i: integer;
begin
  FXYDown := Point(-1,-1);
  FItemUp := FindItemAtPoint(Point(X + TopLeft.X,Y + TopLeft.Y));


  if (FItemUp = FItemDown) and Assigned(FItemUp) and not FXYMoving then
  begin
    if not MultiSelect or (Shift = []) then
    begin
      if MultiSelect then
        ClearSelection;


      DoSelectItem(FItemUp.Index);
      Refresh;
      DoItemClick(FItemUp);


      FLastItemClick := FItemUp.Index;

  

We've done a small improvement to allow to clear the list from this event.
The next update will have this improvement.

many thanks Bruno

I'm having similar problems with FMX.TMSFNCResponsiveList.  I've change line 1999 as follows to get around AV's.

    if (FHoverIndex <> -1) and (Items.Count - 1 > FHoverIndex) then
      DoItemLeave(Items[FHoverIndex]);

Thanks for this suggestion. I believe though it is better:


    if (FHoverIndex > -1) and (FHoverIndex < Items.Count) then