Persistent form layout issues in the Delphi IDE

I wrote a small IDE extension for Delphi. My form comes from TDockableToolbarForm. I figured out how to get the IDE to keep the form position in the .dst and .dsk files.

Registering the form is as follows:

procedure Register;
begin
  RegisterFieldAddress('MyForm', @MyForm);
  RegisterDesktopFormClass(TMyForm, 'My Form', 'MyForm');
  MyForm := TMyForm.Create(nil);
  MyForm.Show;
end;

and I added the following OnCreate handler to the form:

procedure TMyForm.FormCreate(Sender: TObject);
begin
  inherited;
  AutoSave :=True;
  SaveStateNecessary := True;
  DeskSection := 'My Form';
end;

This led to the following being written to the dst / dsk files:

[My Form]
PercentageSizes=1
Create=1
Visible=0
Docked=1
State=0
Left=0
Top=0
Width=1193
Height=4115
MaxLeft=-1
MaxTop=-1
ClientWidth=1109
ClientHeight=3788
TBDockHeight=4115
LRDockWidth=1193
Dockable=1
StayOnTop=0

This allows you to save the form layout between one run of the IDE and the next. However, I have two problems:

  • When a package was first registered in the IDE, I would like the form to be attached to the left side by default (assuming the user does not use the "Classic Undocked" layout). Right now, he just shows the undocked form.
  • /, . .

, , , .

, TControl.ManualDock , , . , IDE, .

, , , dst , , , .

+4
source share

Source: https://habr.com/ru/post/1542660/


All Articles