make fields editor more robust for multiple forms from Alexandrov Alexandru

git-svn-id: trunk@9166 -
This commit is contained in:
mattias 2006-04-23 20:24:57 +00:00
parent 96da86f260
commit 891c68db93
3 changed files with 13 additions and 35 deletions

View File

@ -1,5 +1,3 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TStreamAsXMLForm','FORMDATA',[
'TPF0'#16'TStreamAsXMLForm'#15'StreamAsXMLForm'#13'ActiveControl'#7#7'Button1'
+#7'Caption'#6#15'StreamAsXMLForm'#12'ClientHeight'#3#178#1#11'ClientWidth'#3

View File

@ -1,26 +1,27 @@
object DSFieldsEditorFrm: TDSFieldsEditorFrm
Caption = 'Fields Editor'
ClientHeight = 288
ClientWidth = 180
ClientWidth = 215
OnClose = FieldsEditorFrmClose
OnDestroy = FieldsEditorFrmDestroy
PixelsPerInch = 96
HorzScrollBar.Page = 179
Position = poDefaultPosOnly
HorzScrollBar.Page = 214
VertScrollBar.Page = 287
Left = 228
Left = 256
Height = 288
Top = 96
Width = 180
Top = 117
Width = 215
object FieldsListBox: TListBox
Align = alClient
ExtendedSelect = True
BorderSpacing.OnChange = nil
MultiSelect = True
OnClick = ListBox1Click
OnKeyDown = FieldsListBoxKeyDown
PopupMenu = PopupMenu1
TabOrder = 0
Height = 288
Width = 180
Width = 215
end
object PopupMenu1: TPopupMenu
left = 8

View File

@ -174,10 +174,13 @@ end;
procedure TDSFieldsEditorFrm.FieldsEditorFrmDestroy(Sender: TObject);
begin
if Assigned(FComponentEditor) then begin
if Assigned(LinkDataset) And (Not (csDestroying in LinkDataset.ComponentState)) And (FieldsListBox.SelCount > 0) then
GlobalDesignHook.SelectOnlyThis(LinkDataset);
FComponentEditor.EditorWindowClose;
end;
if Assigned(GlobalDesignHook) then
GlobalDesignHook.RemoveAllHandlersForObject(Self);
if Assigned(FComponentEditor) then
FComponentEditor.EditorWindowClose;
inherited Destroy;
end;
@ -413,10 +416,6 @@ end;
procedure TFieldsComponentEditor.ExecuteVerb(Index: Integer);
var ADataset: TDataset;
i: Integer;
b: boolean;
fTop, fLeft, fHeight, fWidth: integer;
aForm: TForm;
begin
case index of
0: begin
@ -424,27 +423,7 @@ begin
if ADataset = nil
then raise Exception.Create('TFieldsComponentEditor.Edit LinkDataset=nil');
if fWindowClosed then begin
//close other Fields designer forms
// and save window pos.
b := False;
with Application do
for i := 0 to ComponentCount - 1 do
if Components[i] is TDSFieldsEditorFrm then begin
b := True;
aForm := Components[i] as TDSFieldsEditorFrm;
fTop := aForm.Top;
fLeft := aForm.Left;
fHeight := aForm.Height;
fWidth := aForm.Width;
TDSFieldsEditorFrm(Components[i]).Free;
end;
FFieldsEditorForm := TDSFieldsEditorFrm.Create(Application, ADataset, Designer);
if b then begin
FFieldsEditorForm.Top := fTop;
FFieldsEditorForm.Left := fLeft;
FFieldsEditorForm.Height := fHeight;
FFieldsEditorForm.Width := fWidth;
end;
fWindowClosed := False;
end;
with FFieldsEditorForm do begin