Class TLinkEdit (unit HJLnkEdt) |
Inherits from
TCustomEdit
constructor Create(AOwner: TComponent);
- Public declarations
destructor Destroy;
Create
procedure BoundsChanged;
CreateParams
procedure CreateParams(var Params: TCreateParams);
Destroy
procedure DoEnter;
StopTracking;
procedure DoExit;
DoEnter
procedure EditButtonClick;
SetLinkStyle
procedure KeyDown(var Key: Word; Shift: TShiftState);
WMSetCursor
procedure KeyPress(var Key: Char);
Protected declarations KeyDown
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
TrackButton (*
procedure TLinkEdit.
procedure MouseMove(Shift: TShiftState; X, Y: Integer);
MouseDown
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
function GetTextMargins: TPoint;
Remove the elipsis button (if present) when we lose focus
procedure SetLinkStyle(Value: TLinkStyle);
BoundsChanged
procedure StopTracking;
MouseMove
procedure TrackButton(X,Y: Integer);
if the mouse was released (after being pressed) on the button
then perform its associated action
procedure WMPaint(var Message: TWMPaint);
EditButtonClick
procedure WMSetCursor(var Msg: TWMSetCursor);
WMPaint (*
procedure TLinkEdit.
property Alignment : TAlignment
property AutoSelect :
Published declarations
property AutoSize :
property BorderStyle :
property CharCase :
property Color :
property Ctl3D :
property DragCursor :
property DragMode :
property Enabled :
property Font :
property HideSelection :
property LinkStyle : TLinkStyle
property MaxLength :
property OEMConvert :
property ParentColor :
property ParentCtl3D :
property ParentFont :
property ParentShowHint :
property PasswordChar :
property PopupMenu :
property ReadOnly :
property ShowHint :
property TabOrder :
property TabStop :
property Text :
property Visible :
event OnButtonClick : TNotifyEvent
event OnChange :
event OnClick :
event OnDblClick :
event OnDragDrop :
event OnDragOver :
event OnEndDrag :
event OnEnter :
event OnExit :
event OnKeyDown :
event OnKeyPress :
event OnKeyUp :
event OnMouseDown :
event OnMouseMove :
event OnMouseUp :
event OnStartDrag :
FAlignment : TAlignment;
fButtonWidth : integer;
Private declarations
FCanvas : TControlCanvas;
fLinkStyle : TLinkStyle;
fOnButtonClick : TNotifyEvent;
fPressed : boolean;
fTracking : boolean;
constructor Create(AOwner: TComponent);
Public declarations
destructor Destroy;
Create
procedure BoundsChanged;
CreateParams
procedure CreateParams(var Params: TCreateParams);
Destroy
procedure DoEnter;
StopTracking;
procedure DoExit;
DoEnter
procedure EditButtonClick;
SetLinkStyle
procedure KeyDown(var Key: Word; Shift: TShiftState);
WMSetCursor
procedure KeyPress(var Key: Char);
Protected declarations
KeyDown
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
TrackButton (*
procedure TLinkEdit.PaintWindow(DC: HDC);
var
R: TRect;
Flags: Integer;
W: Integer;
begin
{ here's where we draw the little elipsis button when necessary -
most times it is normal (raised) state, but sometimes it is pressed }
if (fLinkStyle <> lsNormal) and (focused or (csDesigning in ComponentState)) then
begin
SetRect(R, ClientWidth - fButtonWidth, 0, ClientWidth, ClientHeight);
Flags := 0;
if FPressed then
Flags := BF_FLAT;
DrawEdge(DC, R, EDGE_RAISED, BF_RECT or BF_MIDDLE or Flags);
Flags := ((R.Right - R.Left) shr 1) - 1 + Ord(fPressed);
W := Height shr 3;
if W = 0 then W := 1;
PatBlt(DC, R.Left + Flags, R.Top + Flags, W, W, BLACKNESS);
PatBlt(DC, R.Left + Flags - (W * 2), R.Top + Flags, W, W, BLACKNESS);
PatBlt(DC, R.Left + Flags + (W * 2), R.Top + Flags, W, W, BLACKNESS);
ExcludeClipRect(DC, R.Left, R.Top, R.Right, R.Bottom);
end;
inherited PaintWindow(DC);
end; // PaintWindow
procedure MouseMove(Shift: TShiftState; X, Y: Integer);
MouseDown
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
function GetTextMargins: TPoint;
Remove the elipsis button (if present) when we lose focus
procedure SetLinkStyle(Value: TLinkStyle);
BoundsChanged
procedure StopTracking;
MouseMove
procedure TrackButton(X,Y: Integer);
if the mouse was released (after being pressed) on the button
then perform its associated action
procedure WMPaint(var Message: TWMPaint);
EditButtonClick
procedure WMSetCursor(var Msg: TWMSetCursor);
WMPaint (*
procedure TLinkEdit.WMPaint(var Message: TWMPaint);
begin
PaintHandler(Message)
end; // WMPaint
property Alignment : TAlignment
property AutoSelect :
Published declarations
property AutoSize :
property BorderStyle :
property CharCase :
property Color :
property Ctl3D :
property DragCursor :
property DragMode :
property Enabled :
property Font :
property HideSelection :
property LinkStyle : TLinkStyle
property MaxLength :
property OEMConvert :
property ParentColor :
property ParentCtl3D :
property ParentFont :
property ParentShowHint :
property PasswordChar :
property PopupMenu :
property ReadOnly :
property ShowHint :
property TabOrder :
property TabStop :
property Text :
property Visible :
event OnButtonClick : TNotifyEvent
event OnChange :
event OnClick :
event OnDblClick :
event OnDragDrop :
event OnDragOver :
event OnEndDrag :
event OnEnter :
event OnExit :
event OnKeyDown :
event OnKeyPress :
event OnKeyUp :
event OnMouseDown :
event OnMouseMove :
event OnMouseUp :
event OnStartDrag :
FAlignment : TAlignment;
fButtonWidth : integer;
Private declarations
FCanvas : TControlCanvas;
fLinkStyle : TLinkStyle;
fOnButtonClick : TNotifyEvent;
fPressed : boolean;
fTracking : boolean;