Class TGrabBar (unit GrabBar)

Inherits from

TCustomControl

Constructors


constructor Create(AOwner: TComponent);

Note that the "hook" is not installed here.


Functions

destructor Destroy;

Set Defaults

procedure CreateParams(var Params: TCreateParams);

Position it correctly with the bar.

function GetThickness: Integer;

Return the thickness of the bar, depending on the orientation.

function GetVersion: TDFSVersion;


procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

Mouse button has been pressed.

procedure MouseMove(Shift: TShiftState; X, Y: Integer);

The mouse has moved.

procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

The mouse button has been released, update the position of the } { bar and it's windows.

procedure Notification(AComponent: TComponent; Operation: TOperation);

We have be notified of a change in the on-form components.

procedure SetBorderStyle(Value: TBorderStyle);

Property methods

BorderStyle property has changed.


procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer);

Every change to Top, Left, Width and Height come through this procedure.

procedure SetParent(Value: TWinControl);

Overriden methods

A Parent has been assigned or changed.


procedure SetStyle(Value: TGrabBarStyle);

Set whether the bar is horizontal or vertical, setting the cursor } { accordingly.

procedure SetThickness(Value: Integer);

Set the thickness, depending on the orientation.

procedure SetVersion(const Val: TDFSVersion);


procedure SetWindowA(Value: TWinControl);

Set a window we are responsible for.

procedure SetWindowB(Value: TWinControl);

Set a window we are responsible for.

function BarRect(APoint: TPoint): TRect;

Function to calculate rectangle coordinates of the bar given a point.

function ClientToParent(APoint: TPoint): TPoint;

Convert from our client coordinates to parent's client coordinates.

procedure CMCtl3DChanged(var Message: TMessage);

Message response methods

The value of the Ctl3D property has changed, invalidate the control so } { that it is redrawn to reflect the change.


procedure HookParent;

Utility functions

This procedure is used to get the parent's window procedure, save it, } { and replace it with our own.


procedure HookWndProc(var Message: TMessage);

The window procedure that is installed into our parent.

procedure InvertedRect(R: TRect; InvertLast: boolean);

Draw an inverted rectangle on the parent to indicate where the bar } { will be when it is released.

procedure MoveWindows;

Reposition the windows we are responsible for.

procedure ResizeBar;

Reset the bar's size to fill the client's width or height.

procedure UnhookParent;

Remove our window function and reinstall the original.

procedure WMEraseBkgnd(var Msg: TWMEraseBkgnd);


procedure WMMove(var Msg: TWMMove);

We have been moved.

procedure WMSize(var Msg: TWMSize);

We have been resized.

Properties

property BorderStyle : TBorderStyle


property Color :

Publish Inherited Protected Properties

property Ctl3D :


property Cursor :


property DragUpdate : boolean


property Hint :


property ParentColor :


property ParentCtl3D :


property ParentShowHint :


property ShowHint :


property Style : TGrabBarStyle


property Thickness : integer


property Version : TDFSVersion

Properties

property Visible :


property WindowA : TWinControl


property WindowAMinSize : integer


property WindowB : TWinControl


property WindowBMinSize : integer


Events

event OnClick :

Publish Inherited Protected Events

event OnDblClick :


event OnMouseDown :


event OnMouseMove :


event OnMouseUp :


event OnMove : TNotifyEvent

Events

Variables

FBorderStyle : TBorderStyle;

Property Variables

FDragging : boolean;


FDragUpdate : boolean;


FOnMove : TNotifyEvent;

Event Variables

FStyle : TGrabBarStyle;


FWindowA : TWinControl;


FWindowAMinSize : integer;


FWindowB : TWinControl;


FWindowBMinSize : integer;

0 or negative value = no minimum

LastRect : TRect;

Internal Variables

NewWndProc : Pointer;


OldWndProc : TFarProc;



Constructors


constructor Create(AOwner: TComponent);

Note that the "hook" is not installed here. Parent is not valid in the } { constructor. See SetParent.


Functions


destructor Destroy;

Set Defaults


procedure CreateParams(var Params: TCreateParams);

Position it correctly with the bar.


function GetThickness: Integer;

Return the thickness of the bar, depending on the orientation.


function GetVersion: TDFSVersion;


procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

Mouse button has been pressed. Setup for moving the bar. This is only } { called when the application is running, not in design mode.


procedure MouseMove(Shift: TShiftState; X, Y: Integer);

The mouse has moved. Move the indicator bar accordingly.


procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

The mouse button has been released, update the position of the } { bar and it's windows.


procedure Notification(AComponent: TComponent; Operation: TOperation);

We have be notified of a change in the on-form components. If it is one } { that we are responsible for, update variables accordingly.


procedure SetBorderStyle(Value: TBorderStyle);

Property methods

BorderStyle property has changed. Redraw control to reflect change.


procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer);

Every change to Top, Left, Width and Height come through this procedure. } { The statement: Top := 10; will result in the procedure being called. By } { overriding it, we can ensure that the windows our repositioned every time } { we are moved.


procedure SetParent(Value: TWinControl);

Overriden methods

A Parent has been assigned or changed. Unhook old parent and install } { hook in new parent.


procedure SetStyle(Value: TGrabBarStyle);

Set whether the bar is horizontal or vertical, setting the cursor } { accordingly.


procedure SetThickness(Value: Integer);

Set the thickness, depending on the orientation.


procedure SetVersion(const Val: TDFSVersion);


procedure SetWindowA(Value: TWinControl);

Set a window we are responsible for. Do not allow selection of ourself or } { the other window being split.


procedure SetWindowB(Value: TWinControl);

Set a window we are responsible for. Do not allow selection of ourself or } { the other window being split.


function BarRect(APoint: TPoint): TRect;

Function to calculate rectangle coordinates of the bar given a point.


function ClientToParent(APoint: TPoint): TPoint;

Convert from our client coordinates to parent's client coordinates.


procedure CMCtl3DChanged(var Message: TMessage);

Message response methods

The value of the Ctl3D property has changed, invalidate the control so } { that it is redrawn to reflect the change.


procedure HookParent;

Utility functions

This procedure is used to get the parent's window procedure, save it, } { and replace it with our own. This allows see all of the parent's messages } { before it does.


procedure HookWndProc(var Message: TMessage);

The window procedure that is installed into our parent.


procedure InvertedRect(R: TRect; InvertLast: boolean);

Draw an inverted rectangle on the parent to indicate where the bar } { will be when it is released.


procedure MoveWindows;

Reposition the windows we are responsible for.


procedure ResizeBar;

Reset the bar's size to fill the client's width or height.


procedure UnhookParent;

Remove our window function and reinstall the original.


procedure WMEraseBkgnd(var Msg: TWMEraseBkgnd);


procedure WMMove(var Msg: TWMMove);

We have been moved. Make sure we are as wide or tall as the parent.


procedure WMSize(var Msg: TWMSize);

We have been resized. Make sure we are as wide or tall as the parent.


Properties


property BorderStyle : TBorderStyle


property Color :

Publish Inherited Protected Properties


property Ctl3D :


property Cursor :


property DragUpdate : boolean


property Hint :


property ParentColor :


property ParentCtl3D :


property ParentShowHint :


property ShowHint :


property Style : TGrabBarStyle


property Thickness : integer


property Version : TDFSVersion

Properties


property Visible :


property WindowA : TWinControl


property WindowAMinSize : integer


property WindowB : TWinControl


property WindowBMinSize : integer


Events


event OnClick :

Publish Inherited Protected Events


event OnDblClick :


event OnMouseDown :


event OnMouseMove :


event OnMouseUp :


event OnMove : TNotifyEvent

Events


Variables


FBorderStyle : TBorderStyle;

Property Variables


FDragging : boolean;


FDragUpdate : boolean;


FOnMove : TNotifyEvent;

Event Variables


FStyle : TGrabBarStyle;


FWindowA : TWinControl;


FWindowAMinSize : integer;


FWindowB : TWinControl;


FWindowBMinSize : integer;

0 or negative value = no minimum


LastRect : TRect;

Internal Variables


NewWndProc : Pointer;


OldWndProc : TFarProc;