Skip to main content

Persisting Settings of Controls Residing in Dock Panels

  • 2 minutes to read

When docking operations are performed, dock control handles change. As a result, child control handles are also changed. This creates a number of issues with control that reside on dock panels. For instance, memo controls loose their selection settings. The same situation takes place when enabling or disabling the auto hide feature for a dock control.

To avoid such losses when docking, you can handle the OnStartDocking and OnEndDocking events. The first enables you to save the desired settings. The second event should be handled to restore them. If you need to persist settings when enabling or disabling the auto hide feature for a dock control, handle its OnAutoHideChanging and OnAutoHideChanged events. These also enable you to save settings before the handle is changed and restore them after the operation has completed.

A common approach to persisting control settings residing on dock panels is also available - the OnParentChanging and OnParentChanged events. The first fires before the dock panel handle is changed. Handle it to save the desired settings. The second event is raised immediately after the handle has been changed thus allowing you to restore the saved settings.

If the OnParentChanging and OnParentChanged events are handled, you have no need to write any additional event handlers to implement settings persistence.

See Also