Author: Jonas Bilinkevicius
I want to know how to prevent an undocked control from destroying when I clicked on
the X shaped close button on the right corner.
Answer:
You have to create your own docksite form:
1 type2 TNoCloseDockform = class(TCustomDockForm)
3 private4 procedure WMSysCommand(var msg: TWMSyscommand); message WM_SYSCOMMAND;
5 end;
6 7 { TNoCloseDockform }8 9 procedure TNoCloseDockform.WMSysCommand(var msg: TWMSyscommand);
10 begin11 if (msg.CmdType and $FFF0) = SC_CLOSE then12 Msg.result := 0
13 else14 inherited;
15 end;
16 17 procedure TForm1.FormCreate(Sender: TObject);
18 begin19 panel1.FloatingDockSiteClass := TNoCloseDockform;
20 end;