- fixed doubling of columns if ListView handle had been created during load process (report 0008794)

git-svn-id: trunk@11056 -
This commit is contained in:
paul 2007-05-03 01:46:24 +00:00
parent 32a03c1212
commit ecd9cd39c7
3 changed files with 16 additions and 1 deletions

View File

@ -728,6 +728,7 @@ type
FTag: Integer;
function GetWidth: TWidth;
procedure WSCreateColumn;
procedure WSDestroyColumn;
function WSUpdateAllowed: Boolean;
procedure SetVisible(const AValue: Boolean);
procedure SetAutoSize(const AValue: Boolean);

View File

@ -101,6 +101,16 @@ begin
WSC.ColumnSetVisible(LV, Index, Self, FVisible);
end;
procedure TListColumn.WSDestroyColumn;
var
LV: TCustomListView;
WSC: TWSCustomListViewClass;
begin
LV := TListColumns(Collection).FOwner;
WSC := TWSCustomListViewClass(LV.WidgetSetClass);
WSC.ColumnDelete(LV, Index);
end;
function TListColumn.WSUpdateAllowed: Boolean;
begin
Result := (Collection <> nil)

View File

@ -98,7 +98,11 @@ procedure TListColumns.WSCreateColumns;
var
n: Integer;
begin
for n :=0 to Count - 1 do
// remove columns at first if exists to prevent doubling them
for n := Count - 1 downto 0 do
GetItem(n).WSDestroyColumn;
for n := 0 to Count - 1 do
GetItem(n).WSCreateColumn;
end;