mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 20:39:23 +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;
|
Classes, SysUtils, Forms, ComCtrls, StdCtrls;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TCollectionPropertyEditor }
|
{ TCollectionPropertyEditorForm }
|
||||||
|
|
||||||
TCollectionPropertyEditorForm = class(TForm)
|
TCollectionPropertyEditorForm = class(TForm)
|
||||||
CollectionListBox: TListBox;
|
CollectionListBox: TListBox;
|
||||||
@ -221,8 +221,8 @@ end;
|
|||||||
procedure TCollectionPropertyEditorForm.PersistentDeleting(APersistent: TPersistent);
|
procedure TCollectionPropertyEditorForm.PersistentDeleting(APersistent: TPersistent);
|
||||||
var
|
var
|
||||||
OldCollection: TCollection;
|
OldCollection: TCollection;
|
||||||
|
AIndex, I: Integer;
|
||||||
begin
|
begin
|
||||||
//debugln('TCollectionPropertyEditorForm.PersistentDeleting A APersistent=',dbgsName(APersistent),' OwnerPersistent=',dbgsName(OwnerPersistent));
|
|
||||||
if APersistent = OwnerPersistent then
|
if APersistent = OwnerPersistent then
|
||||||
begin
|
begin
|
||||||
OldCollection := Collection;
|
OldCollection := Collection;
|
||||||
@ -232,6 +232,22 @@ begin
|
|||||||
GlobalDesignHook.LookupRoot := nil;
|
GlobalDesignHook.LookupRoot := 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;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user