IDE: fix fields editor cannot delete multi-selection, issue #25892

git-svn-id: trunk@48767 -
This commit is contained in:
jesus 2015-04-17 06:28:14 +00:00
parent a17502cadb
commit d1c8efd0c4

View File

@ -87,6 +87,9 @@ type
LinkDataset: TDataset; LinkDataset: TDataset;
FDesigner: TComponentEditorDesigner; FDesigner: TComponentEditorDesigner;
FComponentEditor: TFieldsComponentEditor; FComponentEditor: TFieldsComponentEditor;
FUpdateSelectionCount: Integer;
procedure BeginUpdateSelection;
procedure EndUpdateSelection;
procedure ExchangeItems(const fFirst, fSecond: integer); procedure ExchangeItems(const fFirst, fSecond: integer);
procedure RefreshFieldsListBox(SelectAllNew: boolean); procedure RefreshFieldsListBox(SelectAllNew: boolean);
function FindChild(ACandidate: TPersistent; out AIndex: Integer): Boolean; function FindChild(ACandidate: TPersistent; out AIndex: Integer): Boolean;
@ -194,8 +197,9 @@ begin
LinkDataSet.Active := False; LinkDataSet.Active := False;
if FieldsListBox.SelCount = 0 then if FieldsListBox.SelCount = 0 then
exit; exit;
BeginUpdateSelection;
FDesigner.DeleteSelection; FDesigner.DeleteSelection;
SelectionChanged; EndUpdateSelection;
if PreActive then if PreActive then
LinkDataSet.Active := True; LinkDataSet.Active := True;
end; end;
@ -398,6 +402,8 @@ end;
procedure TDSFieldsEditorFrm.SelectionChanged(AOrderChanged: Boolean = false); procedure TDSFieldsEditorFrm.SelectionChanged(AOrderChanged: Boolean = false);
var SelList: TPersistentSelectionList; var SelList: TPersistentSelectionList;
begin begin
if FUpdateSelectionCount>0 then
exit;
GlobalDesignHook.RemoveHandlerSetSelection(@OnSetSelection); GlobalDesignHook.RemoveHandlerSetSelection(@OnSetSelection);
try try
SelList := TPersistentSelectionList.Create; SelList := TPersistentSelectionList.Create;
@ -474,6 +480,18 @@ begin
end; end;
end; end;
procedure TDSFieldsEditorFrm.BeginUpdateSelection;
begin
Inc(FUpdateSelectionCount);
end;
procedure TDSFieldsEditorFrm.EndUpdateSelection;
begin
dec(FUpdateSelectionCount);
if FUpdateSelectionCount=0 then
SelectionChanged;
end;
{ TFieldsComponentEditor } { TFieldsComponentEditor }
function TFieldsComponentEditor.GetVerbCount: Integer; function TFieldsComponentEditor.GetVerbCount: Integer;