Skip to main content

TdxCustomDockControl.OnActivate Event

Fires when a dock control is activated or deactivated.

Declaration

property OnActivate: TdxActivateEvent read; write;

Remarks

The currently active dock control is specified by the docking controller’s ActiveDockControl property. The docking controller can be accessed using the dxDockingController function. To activate a specific control, call its Activate.

End-users can activate controls by clicking their captions. If the doActivateAfterDocking option is enabled, dock controls are automatically activated after performing docking operations. This option can be accessed via the Options property of the docking manager.

When the active dock control is changed, the OnActivate event fires for the previously and currently active controls. For the previously active control, the Active parameter returns False. For the activated one, it returns True. The Sender parameter identifies the control whose active state has been changed.

The OnActivate event can be used for display purposes or to help end-users when working with dock controls. For instance, when a control is activated you can move focus to one of controls residing on it and display explanatory information within the status bar.

Switching between tabs within a tab container also fires the OnActivate event for the control’s immediate children. To respond to switching between tabs, you can also handle the OnActiveChildChanged event of the tab container.

The following sample code shows how to use the OnActivate event to change the form’s caption when a dock control is activated or deactivated. If activated, the form’s caption is set to the Caption property of the dock control. Otherwise, it is set to the ‘Docking Demo‘ string.

procedure TForm1.dxDockPanel1Activate(Sender: TdxCustomDockControl; Active: Boolean);
begin
  if Active then
    Sender.ParentForm.Caption := Sender.Caption
  else
    Sender.ParentForm.Caption := 'Docking Demo';
end; 
See Also