TdxCustomDockControl.OnCloseQuery Event
Enables you to override the control’s behavior when it is being closed.
Declaration
property OnCloseQuery: TdxDockControlCloseQueryEvent read; write;
Remarks
End-users can close a dock control by clicking the close button within the control’s caption. You can also close the control using code by calling its Close method. In both cases, the OnCloseQuery event is raised before the control is actually closed. Handle this event if you need to restrict control closing depending on conditions or if you require custom functionality. If you only need to perform actions when closing a control, handle the OnClose event instead.
Use the event’s CanClose parameter to specify whether closing is allowed. If you need to prevent the control closing depending on conditions, simply set this parameter to False when these are met. The control being closed is identified by the Sender parameter.
The following code shows how to handle the OnCloseQuery event to implement custom closing behavior. It cancels the default behavior and, instead, docks the dock control to the left edge of a dock site and enables the control’s auto hide feature.
procedure TForm1.dxDockPanel1CloseQuery(Sender: TdxCustomDockControl; var CanClose: Boolean);
begin
CanClose := False;
Sender.DockTo(dxDockSite1, dtLeft, -1);
Sender.AutoHide := True;
end;