Contains an extended notebook with support for dragging and dropping tabs on the control.

extendednotebook.pas contains classes and types used to implement an extended notebook control. It provides support for dragging and dropping tabs on the control.

extendednotebook.pas is part of the LazControls package.

Specifies an event handler signalled for a drag/drop event on a notebook tab.

TNotebookTabDragDropEvent is the type used for the OnTabDragDropEx property in TExtendedNotebook. It is used to perform actions needed when a tab on a TExtendedNotebook control is moved to a new location using drag and drop.

An application must implement and assign an object method which uses this signature to respond to the event notification. It is signalled from the DragDrop method in TExtendedNotebook, and occurs after its OnTabDragOverEx event.

Object for the notification. Control where the drag operation originated. Original ordinal position for the dragged tab. New ordinal position for the dragged tab. True if the Ctrl key is pressed during the drag and drop operation. True if the tab can be moved to the new location. Specifies an event handler signalled when a dragged tab is over a notebook control. Object for the notification. Control where the drag operation originated. Original ordinal position for the dragged tab. New ordinal position for the dragged tab. True if the Ctrl key is pressed during the drag and drop operation. True if the notebook control can accept the dragged tab. Implements a notebook or page control which supports drag and drop events for its tabs.

TExtendedNotebook is a TPageControl descendant, and extends the ancestor class with properties, methods, and events which enable drag and drop operations for the tabs on the paged notebook control. It works in conjunction with the DragManager (TDragManager) instance for the LCL interface.

Overridden methods are provided initiates and completes a drag and drop operation, as well as handle mouse up, down and move messages for the control. Event handlers signalled during drag and drop are also provided. Additional properties are introduced to indicate how drop / drop operations are handled by the control and to identify the tab affected by the operation.

TExtendedNotebook is used in the implementation of TSourceWindow in the Lazarus IDE, where it provides access to the source editor for a tab, as well as its form and anchor design surfaces.

TPageControl TDragManager DragManager
Handles mouse down messages for the control.

MouseDown is an overridden method in TExtendedNotebook. It initializes members used to track drag and drop operations in the class instance, and sets the DragCursor for the control. It calls the inherited MouseDown method to handle an OnEditingDone event for the ActiveControl on the parent form. It updates DragManager for the mouse button in the notification, and signals the OnMouseDown event handler (when assigned). When DragMode is set to dmAutomatic, a left mouse button event causes the value in MouseCapture to be set to True.

MouseDown is called from methods which process LM_LBUTTONDOWN, LM_RBUTTONDOWN, LM_MBUTTONDOWN, and LM_XBUTTONDOWN window messages for the control.

TControl.OnEditingDone TControl.MouseDown TControl.WMLButtonDown TControl.WMRButtonDown TControl.WMMButtonDown TControl.WMXButtonDown
Mouse button for the event. Shift, Ctrl, or Alt modifier for the mouse button event. Horizontal coordinate for the mouse pointer. Vertical coordinate for the mouse pointer. Handles mouse up events for the control. Mouse button for the event. Shift, Ctrl, or Alt modifier for the mouse button event. Horizontal coordinate for the mouse pointer. Vertical coordinate for the mouse pointer. Handles mouse move messages for the control. Shift, Ctrl, or Alt modifier for the mouse button event. Horizontal coordinate for the mouse pointer. Vertical coordinate for the mouse pointer. Handles control notification messages for the control. Message examined in the method. Removes the page at the specified ordinal position. Ordinal position for the page removed in the method. Inserts the specified page at the ordinal position in Index. Page instance inserted in the method. Ordinal position where the page instance is inserted. Performs actions when the mouse capture has changed for the control. Performs actions needed when a drag operation is started for the control. Object which is dragged in the operation. Performs actions needed when a drag operation is ended for the control. Target for the drag operation. Horizontal coordinate where the drag operation was ended. Vertical coordinate where the drag operation was ended. Performs actions needed when a drag operation is over a tab on the control. Performs actions needed to cancel a drag operation for the control. Paints the window for the control to the specified device context. TWinControl.PaintWindow TPageControl.TabPosition Device context where the window is drawn. Constructor for the class instance.

Create is the overridden constructor for the class instance. It ensures that internal members used in drag and drop operations are initialized for the class instance.

TPageControl.DragCursor
Owner of the class instance. Performs actions needed when a dragged object is dropped onto the control.

DragDrop is an overridden method in TExtendedNotebook used to perform actions needed when the object in Source is dropped on the control.

If Source is not derived from TExtendedNotebook, or not the tab being dragged in the control, the inherited method is called to signal the OnDragDrop event handler (when assigned). No additional actions are performed in the method when this situation occurs.

The OnTabDragDrop event handler is signalled (when assigned) for the TExtendedNotebook instance in Source. The OnTabDragDropEx event handler is signalled (when assigned) to allow Ctrl + Drag mouse messages to be handled for the control.

If the tab order was changed by the drag operation, the tabs (pages) are re-ordered to reflect the new position.

Object dragged / dropped on to the control. Horizontal coordinate where the drop occurred. Vertical coordinate where the drop occurred. Starts a drag operation for a tab on the control.

Called from the MouseMove method when a mouse down event has occurred on a tab in the control.

Ordinal position for the tab affected in the drag operation. True if the drag operation starts immediately and the drag threshold is ignored. Distance that the mouse must move before the drag operation starts, or -1 to use the default value from the drag manager. Ordinal position for the tab affected by a drag operation.

DraggingTabIndex is a read-only Integer property which contains the ordinal position for the tab or page active in a drag and drop operation. Its value is assigned in methods like BeginDragTab, DoEndDrag, and DragCanceled. The value is set to -1 when drag and drop is not active for the control.

Its value is used in the DragOver and DragDrop methods, and is passed as an argument to event handlers signalled in the class instance.

Event handler signalled when the mouse hovers over a tab on the control during a drag operation. Event handler signalled when the Ctrl key is held while dragging a tab on the control. Event handler signalled when an object is dropped onto a tab on the control. Event handler signalled when an object is dropped onto a tab on the control while the Ctrl key is held. Event handler signalled when a drag operation is ended for a tab on the control. Event handler signalled when a drag operation is started for a tab on the control. Indicates how a Drag operation is started for a tab on the control.

The default value for the property is dmManual, and indicates that the operation is started in code executed by OnTabStartDrag event handler for the control. When set to dmAutomatic, the drag operation is initialized in the MouseDown method when the left mouse button is clicked on a tab for the notebook control.

Default accept mode for a drag operation for a tab.

TabDragAcceptMode is a TDragMode property which indicates how a dragged tab is accepted on the destination control. It is used in the DragDrop method to determine whether the tab is positioned automatically, or handled in code assigned to an event handler.

The default value for the property is dmManual, and indicates that the tab is relocated manually in the OnTabDragDropEx event handler for the control. When set to dmAutomatic, the tab is automatically relocated using the Move method in the Pages collection for the control.