diff --git a/lcl/comctrls.pp b/lcl/comctrls.pp index f5c877d09c..dc4c8afe2d 100644 --- a/lcl/comctrls.pp +++ b/lcl/comctrls.pp @@ -766,19 +766,16 @@ type TListColumns = class(TCollection) private FOwner: TCustomListView; - FUpdateCount: integer; FItemNeedsUpdate: TCollectionItem; FNeedsUpdate: boolean; function GetItem(const AIndex: Integer): TListColumn; procedure WSCreateColumns; procedure SetItem(const AIndex: Integer; const AValue: TListColumn); - protected public constructor Create(TheOwner: TCustomListView); destructor Destroy; override; + procedure Update(Item: TCollectionItem); override; function Add: TListColumn; - procedure BeginUpdate; override; - procedure EndUpdate; override; property Owner: TCustomListView read FOwner; property Items[const AIndex: Integer]: TListColumn read GetItem write SetItem; default; diff --git a/lcl/include/listcolumns.inc b/lcl/include/listcolumns.inc index e51353b8a8..1a322d7f44 100644 --- a/lcl/include/listcolumns.inc +++ b/lcl/include/listcolumns.inc @@ -28,27 +28,6 @@ begin OwnerFormDesignerModified(Owner); end; -procedure TListColumns.BeginUpdate; -begin - {$IFNDEF VER2_0} - inherited; - // if 2.0 is not supported anymore, maybe FUpdateCount can be removed and - // the Changed notification can be used. - {$ENDIF} - inc(FUpdateCount); -end; - -procedure TListColumns.EndUpdate; -begin - {$IFNDEF VER2_0} - inherited; - {$ENDIF} - if FUpdateCount<=0 then - RaiseGDBException('TListColumns.EndUpdate'); - dec(FUpdateCount); - if (FUpdateCount=0) and FNeedsUpdate then Update(FItemNeedsUpdate); -end; - procedure TListColumns.Assign(Source: TPersistent); var I: Integer; @@ -89,6 +68,13 @@ begin EndUpdate; end; +procedure TListColumns.Update(Item: TCollectionItem); +begin + if (Item = nil) and FNeedsUpdate then + Item := FItemNeedsUpdate; + inherited Update(Item); +end; + function TListColumns.GetItem(const AIndex: Integer): TListColumn; begin Result := TListColumn(inherited GetItem(AIndex)); diff --git a/lcl/interfaces/win32/win32wscustomlistview.inc b/lcl/interfaces/win32/win32wscustomlistview.inc index 6b6d6ce17b..795d1d5941 100644 --- a/lcl/interfaces/win32/win32wscustomlistview.inc +++ b/lcl/interfaces/win32/win32wscustomlistview.inc @@ -79,7 +79,8 @@ begin if Count <= Aindex then Exit; // Move column to the last, otherwise our items get shuffeled - ColumnMove(ALV, AIndex, Count - 1, nil); + if AIndex <> Count - 1 then + ColumnMove(ALV, AIndex, Count - 1, nil); ListView_DeleteColumn(hLV, Count - 1); end; diff --git a/lcl/stdctrls.pp b/lcl/stdctrls.pp index 1b9893f914..0066bb9054 100644 --- a/lcl/stdctrls.pp +++ b/lcl/stdctrls.pp @@ -485,6 +485,7 @@ type protected procedure AssignItemDataToCache(const AIndex: Integer; const AData: Pointer); virtual; // called to store item data while the handle isn't created procedure AssignCacheToItemData(const AIndex: Integer; const AData: Pointer); virtual; // called to restore the itemdata after a handle is created + procedure BeginAutoDrag; override; procedure Loaded; override; procedure InitializeWnd; override; procedure FinalizeWnd; override;