mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 05:50:30 +02:00
IDEIntf: Same as previous commit but for DBGridColumnsPropertyEditor.
git-svn-id: trunk@52997 -
This commit is contained in:
parent
6352ec8939
commit
1d7b19f9f2
@ -379,33 +379,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDBGridColumnsPropertyEditorForm.PersistentDeleting(APersistent: TPersistent);
|
procedure TDBGridColumnsPropertyEditorForm.PersistentDeleting(APersistent: TPersistent);
|
||||||
var
|
|
||||||
AIndex, I: Integer;
|
|
||||||
begin
|
|
||||||
if (APersistent = OwnerPersistent) or (APersistent = OwnerComponent) then
|
|
||||||
begin
|
begin
|
||||||
|
// For some reason this is called only when the whole collection is deleted,
|
||||||
|
// for example when changing to another project. Thus clear the whole collection.
|
||||||
|
DebugLn(['TDBGridColumnsPropertyEditorForm.PersistentDeleting: APersistent=', APersistent,
|
||||||
|
', OwnerPersistent=', OwnerPersistent, ', OwnerComponent=', OwnerComponent]);
|
||||||
SetCollection(nil, nil, '');
|
SetCollection(nil, nil, '');
|
||||||
Hide;
|
Hide;
|
||||||
end
|
|
||||||
else
|
|
||||||
if Assigned(Collection) and (APersistent is TCollectionItem) and
|
|
||||||
(TCollectionItem(APersistent).Collection = Collection) then
|
|
||||||
begin
|
|
||||||
// persistent is still alive
|
|
||||||
AIndex := CollectionListBox.ItemIndex;
|
|
||||||
CollectionListBox.Items.BeginUpdate;
|
|
||||||
CollectionListBox.Items.Delete(TCollectionItem(APersistent).Index);
|
|
||||||
for I := TCollectionItem(APersistent).Index to CollectionListBox.Items.Count - 1 do
|
|
||||||
CollectionListBox.Items[I] := IntToStr(I) + ' - ' + Collection.Items[I + 1].DisplayName;
|
|
||||||
CollectionListBox.Items.EndUpdate;
|
|
||||||
if AIndex < CollectionListBox.Items.Count then
|
|
||||||
CollectionListBox.ItemIndex := AIndex
|
|
||||||
else
|
|
||||||
CollectionListBox.ItemIndex := CollectionListBox.Items.Count - 1;
|
|
||||||
end;
|
|
||||||
UpdateButtons;
|
UpdateButtons;
|
||||||
UpdateCaption;
|
UpdateCaption;
|
||||||
//DebugLn('*** TDBGridColumnsPropertyEditorForm.PersistentDeleting called ***');
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDBGridColumnsPropertyEditorForm.RefreshPropertyValues;
|
procedure TDBGridColumnsPropertyEditorForm.RefreshPropertyValues;
|
||||||
|
Loading…
Reference in New Issue
Block a user