Cocoa/ListView: ItemDelete() changed from asynchronous to synchronous #41124

because the selection has been changed to be loaded asynchronously after reloadData
This commit is contained in:
rich2014 2024-09-07 13:52:53 +08:00
parent 7f4c1557a6
commit d5ed1772b9
2 changed files with 1 additions and 20 deletions

View File

@ -151,7 +151,6 @@ type
_collectionView: TCocoaCollectionView;
private
function getCallback: TLCLListViewCallback;
procedure doReloadDataAfterDelete( AIndex: PtrInt );
public
constructor Create( listView: TCocoaListView );
public
@ -1108,18 +1107,6 @@ end;
procedure TCocoaWSListView_CollectionViewHandler.ItemDelete(
const AIndex: Integer);
begin
Application.QueueAsyncCall( @doReloadDataAfterDelete, AIndex );
end;
procedure TCocoaWSListView_CollectionViewHandler.doReloadDataAfterDelete( AIndex: PtrInt );
var
lclcb : TLCLListViewCallback;
begin
lclcb:= getCallback;
if NOT Assigned(lclcb) then
Exit;
lclcb.selectionIndexSet.shiftIndexesStartingAtIndex_by( AIndex+1, -1 );
_collectionView.reloadData;
end;

View File

@ -191,7 +191,6 @@ type
_tableView: TCocoaTableListView;
private
function getCallback: TLCLListViewCallback;
procedure doReloadDataAfterDelete( AIndex: PtrInt );
public
constructor Create( listView: TCocoaListView );
function getColumnFromIndex( const AIndex: Integer ): NSTableColumn;
@ -1528,11 +1527,6 @@ begin
Result:= TLCLListViewCallback( _tableView.lclGetCallback.GetCallbackObject );
end;
procedure TCocoaWSListView_TableViewHandler.doReloadDataAfterDelete( AIndex: PtrInt);
begin
_tableView.lclDeleteItem( AIndex );
end;
procedure TCocoaWSListView_TableViewHandler.ColumnDelete(
const AIndex: Integer);
var
@ -1714,7 +1708,7 @@ end;
procedure TCocoaWSListView_TableViewHandler.ItemDelete(const AIndex: Integer
);
begin
Application.QueueAsyncCall( @doReloadDataAfterDelete, AIndex );
_tableView.lclDeleteItem( AIndex );
end;
function TCocoaWSListView_TableViewHandler.ItemDisplayRect(const AIndex,