Иллюстрированный самоучитель по Delphi 7 для профессионалов

Создание нового компонента на базе элементов управления из библиотеки ComCtl32

Листинг 5.2. Исходный код компонента TCustomlPEdit.

unit uIPEdit;
interface
uses
Windows, Messages, SysUtils, Classes, Controls;
type
TCustomlPEdit = class(TWinControl)
private
{ Private declarations }
FIPAddress: DWORD;
FIPLimits: array [0..3] of word;
FCurrentField: Integer;
//procedure CMWantSpecialKey(var Msg: TCMWantSpecialKey);
message CM_WANTSPECIALKEY;
procedure WMGetDlgCode(var Message: TWMGetDlgCode);
message WM_GETDLGCODE;
procedure CMDialogChar(var Message: TCMDialogChar);
message CM_DIALOGCHAR;
//procedure CMDialogKey(var Message: TCMDialogKey);
message CM_DIALOGKEY;
procedure CNNotify(var Message: TWMNotify);
message CN_NOTIFY;
protected
{ Protected declarations }
function GetIP(Index: Integer): Byte;
procedure SetIP(Index: Integer; Value: Byte);
function GetMinIP(Index: Integer): Byte;
procedure SetMinIP(Index: Integer; Value: Byte);
function GetMaxIP(Index: Integer): Byte;
procedure SetMaxIP(Index: Integer; Value: Byte);
function GetlPString: string;
procedure SetlPString(Value: string);
function IsBlank: boolean;
procedure SetCurrentFieldfIndex: Integer);
//
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
//procedure KeyDown(var Key: Word; SHIFT: TSHIFTState);override;
function IPDwordToString(dw: DWORD): string;
function IPStringToDword(s: string): DWORD;
public
{ Public declarations }
constructor Create(AOwner: TComponent);
override;
property IP[Index: Integer]: byte read GetIP write SetIP;
property MinIP[Index: Integer]: byte read GetMinIP write SetMinIP;
property MaxIP[Index: Integer]: byte read GetMaxIP write SetMaxIP;
property IPString: string read GetlPString write SetlPString;
property CurrentField: Integer read FCurrentField write SetCurrentField;
procedure Clear;
end;
TIPEdit = class(TCustomlPEdit)
published
property Align;
property Anchors;
property BorderWidth;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property Hint;
property Constraints;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDock;
property OnStartDrag;
{ Published declarations }
property IPString;
end;
Если Вы заметили ошибку, выделите, пожалуйста, необходимый текст и нажмите CTRL + Enter, чтобы сообщить об этом редактору.