mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 09:19:32 +02:00
ideintf: fix removal of collection item from the collection editor (bug #0015570)
git-svn-id: trunk@23774 -
This commit is contained in:
parent
51487a0dd5
commit
e3398afbb6
@ -8,7 +8,7 @@ uses
|
||||
Classes, SysUtils, Forms, ComCtrls, StdCtrls;
|
||||
|
||||
type
|
||||
{ TCollectionPropertyEditor }
|
||||
{ TCollectionPropertyEditorForm }
|
||||
|
||||
TCollectionPropertyEditorForm = class(TForm)
|
||||
CollectionListBox: TListBox;
|
||||
@ -221,8 +221,8 @@ end;
|
||||
procedure TCollectionPropertyEditorForm.PersistentDeleting(APersistent: TPersistent);
|
||||
var
|
||||
OldCollection: TCollection;
|
||||
AIndex, I: Integer;
|
||||
begin
|
||||
//debugln('TCollectionPropertyEditorForm.PersistentDeleting A APersistent=',dbgsName(APersistent),' OwnerPersistent=',dbgsName(OwnerPersistent));
|
||||
if APersistent = OwnerPersistent then
|
||||
begin
|
||||
OldCollection := Collection;
|
||||
@ -232,6 +232,22 @@ begin
|
||||
GlobalDesignHook.LookupRoot := nil;
|
||||
|
||||
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;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user