mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 20:39:23 +02:00
LCL/TListView: Improved Delphi compatibility by giving life to the empty methods Delete and InsertItem and adding an Edit method.
git-svn-id: trunk@64309 -
This commit is contained in:
parent
db94cc7a39
commit
fbb46cb85d
@ -1511,7 +1511,7 @@ type
|
||||
procedure Change(AItem: TListItem; AChange: Integer); virtual;
|
||||
procedure ColClick(AColumn: TListColumn); virtual;
|
||||
|
||||
procedure Delete(Item : TListItem);
|
||||
procedure Delete(Item : TListItem); virtual;
|
||||
procedure DoDeletion(AItem: TListItem); virtual;
|
||||
procedure DoInsert(AItem: TListItem); virtual;
|
||||
procedure DoItemChecked(AItem: TListItem);
|
||||
@ -1521,8 +1521,9 @@ type
|
||||
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
|
||||
|
||||
procedure DoEndEdit(AItem: TListItem; const AValue: String); virtual;
|
||||
procedure Edit(AItem: TListItem); virtual;
|
||||
|
||||
procedure InsertItem(Item : TListItem);
|
||||
procedure InsertItem(AItem : TListItem); virtual;
|
||||
procedure ImageChanged(Sender : TObject);
|
||||
procedure Loaded; override;
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
|
@ -587,7 +587,8 @@ end;
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TCustomListView.DoDeletion(AItem: TListItem);
|
||||
begin
|
||||
if Assigned(FOnDeletion) then FOnDeletion(Self, AItem);
|
||||
if not (csDestroying in ComponentState) and Assigned(FOnDeletion) then
|
||||
FOnDeletion(Self, AItem);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -595,7 +596,11 @@ end;
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TCustomListView.DoInsert(AItem: TListItem);
|
||||
begin
|
||||
if Assigned(FOnInsert) then FOnInsert(Self, AItem);
|
||||
if not (TMethod(@Self.InsertItem).Code = Pointer(@TCUstomListView.InsertItem)) then
|
||||
//There is an override for InsertItem, so use that for Delphi compatibility. Issue #0038263
|
||||
InsertItem(AItem)
|
||||
else
|
||||
if Assigned(FOnInsert) then FOnInsert(Self, AItem);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -671,6 +676,12 @@ begin
|
||||
AItem.Caption := S;
|
||||
end;
|
||||
|
||||
procedure TCustomListView.Edit(AItem: TListItem);
|
||||
begin
|
||||
if Assigned(AItem) then
|
||||
DoEndEdit(AItem, AItem.Caption);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView ItemDeleted }
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -729,13 +740,15 @@ end;
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TCustomListView.Delete(Item : TListItem);
|
||||
begin
|
||||
Item.Delete;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView InsertItem }
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TCustomListView.InsertItem(Item : TListItem);
|
||||
procedure TCustomListView.InsertItem(AItem : TListItem);
|
||||
begin
|
||||
if Assigned(FOnInsert) then FOnInsert(Self, AItem);
|
||||
end;
|
||||
|
||||
function TCustomListView.IntfCustomDraw(ATarget: TCustomDrawTarget; AStage: TCustomDrawStage; AItem, ASubItem: Integer; AState: TCustomDrawState; const ARect: PRect): TCustomDrawResult;
|
||||
|
Loading…
Reference in New Issue
Block a user