Floating a Docking Control
To float a docking control
-
Left-click the mouse on any part of the docking control.
-
Drag the control to a non-docking position (indicated by a double dotted border on the dragging rectangle).
-
Release the mouse.
Alternatively, you can also float a control by clicking on the docking control, dragging the control while holding down the Ctrl or Shift key, and then releasing the mouse. The Ctrl key causes the floating window to adopt its current horizontal size and the Shift key causes the floating window to adopt the smallest possible horizontal size.
The JadeDockBase class drawGrip property optionally displays a grip bar on the control so that it is easier for the user to click on the control. It can also indicate to the user that the control can be dragged.
Pressing the Esc key before releasing the mouse abandons the dragging process so that docking or floating does not occur.
A docking control can be floated only if its floatingStyle property is not FloatingStyle_None (0) and it has visible children. If the floating style is FloatingStyle_None (0), the control is then effectively just another container with additional alignment capabilities.
Floating a docking control causes the following actions.
-
A new form is created at the position and size shown by the last dragging rectangle. This form has no associated JADE object. The position is modified only if it is necessary to ensure that the top and left position of the form is on the screen.
-
Like the Form class setFormParent method, the form is created as a child of the original form. The floating form therefore always sits above the JADE form on the screen. Minimizing the JADE form also minimizes the floating form. No entry is displayed on the taskbar for the form.
-
The caption for the docking control is used as the title of the form. The caption line of the form is slightly smaller than that of a standard JADE form.
-
The docking control becomes a child of this form. The control does not display any border area (including the grip bar) while it is floating. However, any children of the control are displayed normally.
-
The floatingStyle property of the JadeDockBase class controls whether the form has a Close button.
-
If the parent of the control is a JadeDockContainer control and the control that is being floated is the only visible child, the parent JadeDockContainer control is made invisible.
-
As the Control class parent property of the docking control is a child of the floating form and has no JADE object associated with it, it is set to null. However, the Control class form property remains set to the original JADE form. Use the JadeDockBase class isFloating method of the docking control to determine whether the control is on a floating form.
-
The position and size of the controls on the form are re-evaluated for the effects on their alignments caused by the removal of the control from the form.
-
The floated event method of the docking control is called when the floating process has completed, enabling you to make the required programmatic adjustment to the JADE form.
Floating a docking control causes the form to re-evaluate the alignment of controls affected by the control that is being removed from the form. Floating a control does not cause the form size to be changed or non-aligned controls to be repositioned.
The userResize event method is called on a floating JadeDockBar or JadeDockContainer control if a user resizes a floating form (JadeDockBase control). If you want to differentiate between the userResize event being called when the user drags the resize bar of a control and when the user has resized the floating window, call the isFloating method.
To handle the removal of the docking control from the form, you should place other non-aligned controls on a Frame control that has the alignContainer property set to AlignContainer_All (5) and that is a sibling of the docking control. The alignContainer property automatically handles many floating and docking requirements. (For details, see the alignContainer property.)
If the form is an MDI frame, by default, the MDI client window that hosts the MDI child forms is automatically repositioned and resized (unless Form::moveMdiClient has been called, in which case it is your responsibility to handle this in your logic).
When floating docking controls, you should be aware of the following.
-
All controls on the floating form logically belong to the original JADE form so that all logic associated with those controls is executed.
-
The floating form passes only the gotFocus, lostFocus, keyDown, keyUp, and keyPress events to the parent JADE form. All other events on the floating form are ignored.
-
The original JADE form and its floating forms are activated when any of those forms is activated.
-
Accelerator keys function for controls that reside on the floating form.
-
The Tab key cannot be used to switch between the JADE form and the floating form.
-
Any number of docking controls can become floating windows.
-
You can float a docking control programmatically, by using the JadeDockBase class float method.
-
All JADE forms are constructed with all controls attached to a form in the JADE Painter. Floating a control can be done only by the user or dynamically by logic at run time.
-
Clicking on the caption of a floating form enables the floating form to be dragged. Holding the Shift key down causes the size of the dragging rectangle to toggle between the controls being positioned horizontally and vertically after releasing the mouse.
-
The size of the floating form is always the minimum that is required to host the docking control in its current alignment. The form can be resized only if the controls within the docking control can be automatically repositioned or if the alignContainer property of the docking control is set to AlignContainer_AllHorizontal (5) or AlignContainer_AllVertical (6).
-
The floating form can only be resized in one direction at a time.
-
If the form does not have a Close button, the form is destroyed only when the control is re-docked somewhere else or when the JADE form is closed.
If the floating form has a Close button and it is closed, the docking control is transferred back to being an invisible child of the original JADE form and requires a JADE logic action to make the control visible to the user again.
The dock control that is being hidden receives a docked event. To determine this situation, check the value of the visible property of the control.
-
Use the JadeDockBase class getFloatingPosition method to obtain the most recent size and position of the floating form.
-
You can re-dock floating controls by using logic to change the parent of the control parent back to a window of the JADE form.
-
A floating JadeDockContainer control can also be docked; that is, another docking control could be docked into the floating window if the floating dock control allows such a docking.
-
Before a docking container can be floated, it must have visible children.