- use BeginUpdate and EndUpdate from TCollection instead of own in TListColumns implementation

- commit forgotten file

git-svn-id: trunk@13383 -
This commit is contained in:
paul 2007-12-19 04:40:13 +00:00
parent 550b78239f
commit 0897bb06ff
4 changed files with 11 additions and 26 deletions

View File

@ -766,19 +766,16 @@ type
TListColumns = class(TCollection) TListColumns = class(TCollection)
private private
FOwner: TCustomListView; FOwner: TCustomListView;
FUpdateCount: integer;
FItemNeedsUpdate: TCollectionItem; FItemNeedsUpdate: TCollectionItem;
FNeedsUpdate: boolean; FNeedsUpdate: boolean;
function GetItem(const AIndex: Integer): TListColumn; function GetItem(const AIndex: Integer): TListColumn;
procedure WSCreateColumns; procedure WSCreateColumns;
procedure SetItem(const AIndex: Integer; const AValue: TListColumn); procedure SetItem(const AIndex: Integer; const AValue: TListColumn);
protected
public public
constructor Create(TheOwner: TCustomListView); constructor Create(TheOwner: TCustomListView);
destructor Destroy; override; destructor Destroy; override;
procedure Update(Item: TCollectionItem); override;
function Add: TListColumn; function Add: TListColumn;
procedure BeginUpdate; override;
procedure EndUpdate; override;
property Owner: TCustomListView read FOwner; property Owner: TCustomListView read FOwner;
property Items[const AIndex: Integer]: TListColumn property Items[const AIndex: Integer]: TListColumn
read GetItem write SetItem; default; read GetItem write SetItem; default;

View File

@ -28,27 +28,6 @@ begin
OwnerFormDesignerModified(Owner); OwnerFormDesignerModified(Owner);
end; 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); procedure TListColumns.Assign(Source: TPersistent);
var var
I: Integer; I: Integer;
@ -89,6 +68,13 @@ begin
EndUpdate; EndUpdate;
end; 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; function TListColumns.GetItem(const AIndex: Integer): TListColumn;
begin begin
Result := TListColumn(inherited GetItem(AIndex)); Result := TListColumn(inherited GetItem(AIndex));

View File

@ -79,7 +79,8 @@ begin
if Count <= Aindex then Exit; if Count <= Aindex then Exit;
// Move column to the last, otherwise our items get shuffeled // 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); ListView_DeleteColumn(hLV, Count - 1);
end; end;

View File

@ -485,6 +485,7 @@ type
protected protected
procedure AssignItemDataToCache(const AIndex: Integer; const AData: Pointer); virtual; // called to store item data while the handle isn't created 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 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 Loaded; override;
procedure InitializeWnd; override; procedure InitializeWnd; override;
procedure FinalizeWnd; override; procedure FinalizeWnd; override;