1. TNumIO
const
{$IFDEF PAIDVERS}
SDLVersionInfo = 'numio_r1210_full';
IsLightEd = false;
{$ELSE}
SDLVersionInfo = 'numio_r1210_lighted';
IsLightEd = true;
{$ENDIF}
Release = 1210;
type
TInFormat =(itExp,itFloat,itFixPoint,itInt,itHex,itOct,itBin,itDynamic);
{$IFDEF GE_LEV29}
[ComponentPlatformsAttribute(pidWin32 or pidWin64 or pidWin64x)]
{$ENDIF}
TNumIO = class(TCustomEdit)
private
FInFormat : TInFormat; { type of display: dec, hex,... }
FFixPDecPl : integer;
FOldText : String; {caches the input string to handle errors}
FInternalChg : boolean;
FBeep : boolean; { beep on illegal inputs? }
FMinimum : double; { minimum allowed value }
FMaximum : double; { maximum allowed value }
FDecPSep : TDecPSep;
procedure SetInputFormat (value: TInFormat);
procedure SetRangeLow (value: double);
procedure SetRangeHigh (value: double);
procedure SetLabValue (x: double);
function GetLabValue: double;
procedure SetDecPSep (Value: TDecPSep);
procedure SetFixPDecPl (value: integer);
procedure SetEditText (txt: string);
protected
procedure AssignTo (Dest: TPersistent); override;
function ConvertNumString (Instring: String;
var DReslt: double): boolean;
procedure Change; override;
public
constructor Create (AOwner: TComponent); override;
destructor Destroy; override;
procedure Assign (Source: TPersistent); override;
property Value: double read GetLabValue write SetLabValue;
published
property Anchors;
property Align;
property AutoSelect;
property AutoSize;
property Beep: boolean read FBeep write FBeep;
property BorderStyle;
property Color;
{$IFNDEF ISCLX}
property Ctl3D;
property ParentCtl3D;
{$ENDIF}
property Cursor;
property DecPlaceSep: TDecPSep read FDecPSep write SetDecPSep;
property Enabled;
property FixPointDecPlaces: integer
read FFixPDecPl write SetFixPDecPl;
property Font;
property Height;
property HelpContext;
property HideSelection;
property Hint;
property InputFormat: TInFormat read FInFormat write SetInputFormat;
property Left;
property RangeHigh: double
read FMaximum write SetRangeHigh nodefault;
property RangeLow: double
read FMinimum write SetRangeLow nodefault;
property ReadOnly;
property Name;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Tag;
property Text;
property Top;
property Visible;
property Width;
property OnChange;
property OnClick;
property OnDblClick;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
end;
2. TNumIO2
const
defLeftSpace = 35; // default left space
defFixP = 2; // number of decimal places
defSigDig = 6; // number of significant digits
defTextBoxWidth = 80; // default width of input text box
type
ESDLNumIO2Error = class(ESDLError); // exception type to indicate errors
TOnGaugeChangeEvent = procedure (Sender: TObject; Shift: TShiftState;
GaugeValue: double) of object;
{$IFDEF GE_LEV29}
[ComponentPlatformsAttribute(pidWin32 or pidWin64 or pidWin64x)]
{$ENDIF}
TNumIO2 = class (TCustomControl)
private
FLeftSpace : integer; // space for text left to
// the input box
FSuppressPaint : boolean; // used to avoid premature painting
FTextBoxWidth : integer; // width of numeric field
FValueChanged : boolean; // flag to trigger OnChange event
FDecP : integer; // no. of dec, places - fixed point
FSigDig : integer; // no. of dec, places - fixed point
FEnabled : boolean; // TRUE: control is enabled
FFreezeBoxVisib : boolean; // visibility of auto checkbox
FFreezeBoxSize : integer; // size of FreezeBox
FHideInputOnFreeze: boolean; // TRUE: input field is hidden
// if freeze is active
FFreezeBoxLeft : integer; // left margin of FreezeBox
FFreezeBoxTop : integer; // top margin of FreezeBox
FFreezeBoxChecked : boolean; // TRUE if FreezeBox is checked
FHideNumInEdi : boolean; // hide numeric input editor
FBlockKbd : boolean; // TRUE: keyboard is blocked
FButWidth : integer; // width of attached buttons
FButSpace : integer; // space between edit field
// and button
FButIncrem : double; // button increment
FButVisible : boolean; // visibility of the inc/dec button
FBut3D : boolean; // vis. appearance of button
FButHeight : integer; // height of button
FButColor : TColor; // color of button face
FCaretTimerH : HWND; // handle for caret blinking timer
FInBuffer : string; // input buffer
FCaretPos : integer; // caret position
FCaretVisib : boolean; // visibility state of caret
FGaugeVisib : boolean; // visibility of gauge bar
FGaugeHeight : integer; // height of gauge bar
FGaugeWidth : integer; // width of gáuge bar
FGaugeLeftMarg : integer; // left margin of gauge bar
FGaugeTopMarg : integer; // top margin of gauge
FGaugeColor : TColor; // color of gauge bar
FGaugeColorBg : TColor; // background color of gauge bar
FGaugeColorFrm : TColor; // frame color of gauge bar
FGaugeFrameSt : TFrameStyle; // style of gauge frame
FLeftText : string; // text at left of the input box
FRightText : string; // text at right of the input box
FFrameStyle : TFrameStyle; // style of frame
FAlignment : TAlignment; // alignment of num. input text
FLTAlignment : TAlignment; // alignment of left text
FRTAlignment : TAlignment; // alignment of right text
FMouseAreaCode : integer; // mouse pos. - area code
FColorBoxBG : TColor; // color of text box background
FColorBoxText : TColor; // color of text box
FColorOutBG : TColor; // color of outer background
FColorOutText : TColor; // color of outer text
FColBlackLine : TColor; // colors to draw the frame
FColGrayLine : TColor; // -"-
FColWhiteLine : TColor; // -"-
FColorWarnBG : TColor; // range over/underflow warning color
FColorWarnTxt : TColor; // range over/underflow warning color
FColorScheme : TColorScheme;// color scheme of frames
FSelBegin : integer; // begin of selection range
FSelEnd : integer; // end of selection range
FDecPSep : TDecPSep; // decimal place separator
FInputFormat : TInFormat; // type of display : dec., hex,...
FKeyShifted : boolean; // key state (shift)
FKeyCntrl : boolean; // key state (control)
FHideSel : boolean; // hide selection when no focus
FMaximum : double; // lower border of allowed range
FMinimum : double; // upper border of allowed range
FOnlineCheck : boolean; // perform online check of borders
FBeep : boolean; // sound if invalid input
FReadOnly : boolean; // no input possible
FAutoSize : boolean; // adjust height automatically
FOnChange : TNotifyEvent;// OnChange event
FOnGaugeChange : TOnGaugeChangeEvent;// OnGaugeChange event
procedure SetLeftSpace (Value: integer);
procedure SetColorBoxBG (Value: TColor);
procedure SetColorBoxText (Value: TColor);
procedure SetColorOutBG (Value: TColor);
procedure SetColorOutText (Value: TColor);
procedure SetColorScheme (Value: TColorScheme);
procedure SetFrameStyle (value: TFrameStyle);
procedure SetFreezeBoxSize (value: integer);
procedure SetFreezeBoxLeft (value: integer);
procedure SetFreezeBoxTop (value: integer);
procedure SetFreezeBoxVisib (Value: boolean);
procedure SetFreezeBoxChecked (Value: boolean);
procedure SetGaugeFrameStyle (value: TFrameStyle);
procedure SetGaugeVisib (value: boolean);
procedure SetGaugeHeight (value: integer);
procedure SetGaugeWidth (value: integer);
procedure SetGaugeLeftMarg (value: integer);
procedure SetGaugeTopMarg (value: integer);
procedure SetGaugeColor (value: TColor);
procedure SetGaugeColorBg (value: TColor);
procedure SetGaugeColorFrm (value: TColor);
procedure SetHeight (value: integer);
procedure SetAlignment (value: TAlignment);
procedure SetLTAlignment (value: TAlignment);
procedure SetRTAlignment (value: TAlignment);
procedure SetTextBoxWidth (value: integer);
procedure SetNioText (value: string);
procedure SetNioValue (value: double);
function GetNioValue: double;
function GetNioIntValue: integer;
function GetHeight: integer;
procedure SetReadonly (value: boolean);
procedure SetAutoSize (value: boolean);
procedure SetHideInputEditor (value: boolean);
procedure SetHideInputOnFreeze (value: boolean);
procedure SetHideSel (value: boolean);
procedure SetDecP (value: integer);
procedure SetDecSep (value: TDecPSep);
procedure SetSelBegin (value: integer);
procedure SetSelEnd (value: integer);
procedure SetSigDig (value: integer);
procedure SetLeftText (value: string);
procedure SetRightText (value: string);
procedure SetInFormatType (value: TInFormat);
procedure SetColorWarnBG (value: TColor);
procedure SetColorWarnBoxText (value: TColor);
procedure SetRangeLow (value: double);
procedure SetRangeHigh (value: double);
procedure SetBlockKbd (value: boolean);
procedure SetButVis (value: boolean);
procedure SetBut3D (value: boolean);
procedure SetButHeight (value: integer);
procedure SetButWidth (value: integer);
procedure SetButSpace (value: integer);
procedure SetButColor (value: TColor);
procedure SetButIncrement (value: double);
procedure CNKeyDown(var Message: TWMKeyDown); message CN_KEYDOWN;
procedure CNKeyUp(var Message: TWMKeyUp); message CN_KEYUP;
procedure WMSetFocus(var Message: TWMSetFocus); message WM_SETFOCUS;
procedure UpdateTimer;
function XCoordsToCharPos (X: integer): integer;
function CharPosToXCoords (cp: integer): integer;
protected
procedure CreateWnd; override;
procedure AssignTo (Dest: TPersistent); override;
procedure MouseMove (Shift: TShiftState; X,Y: integer); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseUp (Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure Paint; override;
procedure Click; override;
procedure CaretTimerEvent(Sender: TObject);
procedure SetEnabled (value: boolean); override;
procedure WndProc(var Msg: TMessage);// virtual method of base class
// is hidden deliberately
public
ButtonPivots : TDoubleArray;
procedure Assign(Source: TPersistent); override;
procedure Changed;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function CheckValidity (Instring: string): boolean;
property IntegerValue: integer read GetNioIntValue;
property MouseAreaCode: integer read FMouseAreaCode;
function OutOfRange: boolean;
property SelBegin: integer read FSelBegin write SetSelBegin;
property SelEnd: integer read FSelEnd write SetSelEnd;
procedure SetFocus;
published
property Align;
property Alignment: TAlignMent read FAlignment write SetALignment;
property Anchors;
property AutoSize: boolean read FAutoSize write SetAutoSize;
property Beep: boolean read FBeep write FBeep;
property BlockKbdInput: boolean read FBlockKbd write SetBlockKbd;
property ButVisible: boolean read FButVisible write SetButVis;
property But3D: boolean read FBut3D write SetBut3D;
property ButHeight: integer read FButHeight write SetButHeight;
property ButWidth: integer read FButWidth write SetButWidth;
property ButIncrem: double read FButIncrem write SetButIncrement;
property ButSpace: integer read FButSpace write SetButSpace;
property ButColor: TColor read FButColor write SetButColor;
property ColorBoxBG: TColor
read FColorBoxBG write SetColorBoxBG;
property ColorBoxText: TColor
read FColorBoxText write SetColorBoxText;
property ColorOutBG: TColor
read FColorOutBG write SetColorOutBG;
property ColorOutText: TColor
read FColorOutText write SetColorOutText;
property ColorScheme: TColorScheme
read FColorScheme write SetColorScheme;
property ColorWarnBG: TColor
read FColorWarnBG write SetColorWarnBG;
property ColorWarnText: TColor
read FColorWarnTxt write SetColorWarnBoxText;
property Cursor;
property DecPlaceSep: TDecPSep read FDecPSep write SetDecSep;
property Enabled: boolean read FEnabled write SetEnabled;
property FixPointDecPlaces: integer read FDecP write SetDecP;
property Font;
property FrameStyle: TFrameStyle
read FFrameStyle write SetFrameStyle;
property FreezeBoxChecked: boolean
read FFreezeBoxChecked write SetFreezeBoxChecked;
property FreezeBoxLeft: integer
read FFreezeBoxLeft write SetFreezeBoxLeft;
property FreezeBoxSize: integer
read FFreezeBoxSize write SetFreezeBoxSize;
property FreezeBoxTop: integer
read FFreezeBoxTop write SetFreezeBoxTop;
property FreezeBoxVisible: boolean
read FFreezeBoxVisib write SetFreezeBoxVisib;
property GaugeColor: TColor read FGaugeColor write SetGaugeColor;
property GaugeColorBg: TColor
read FGaugeColorBg write SetGaugeColorBg;
property GaugeColorFrame: TColor
read FGaugeColorFrm write SetGaugeColorFrm;
property GaugeHeight: integer read FGaugeHeight write SetGaugeHeight;
property GaugeFrameStyle: TFrameStyle
read FGaugeFrameSt write SetGaugeFrameStyle;
property GaugeLeftMargin: integer
read FGaugeLeftMarg write SetGaugeLeftMarg;
property GaugeTopMargin: integer
read FGaugeTopMarg write SetGaugeTopMarg;
property GaugeVisible: boolean read FGaugeVisib write SetGaugeVisib;
property GaugeWidth: integer read FGaugeWidth write SetGaugeWidth;
property Height: integer read GetHeight write SetHeight;
property HelpContext;
property HideInputEditor: boolean
read FHideNumInEdi write SetHideInputEditor;
property HideInputOnFreeze: boolean
read FHideInputOnFreeze write SetHideInputOnFreeze;
property HideSelection: boolean read FHideSel write SetHideSel;
property Hint;
property InputFormat: TInFormat
read FInputFormat write SetInFormatType;
property Left;
property LeftSpace: integer read FLeftSpace write SetLeftSpace;
property LeftText: string read FLeftText write SetLefttext;
property LeftTextAlignment: TAlignMent
read FLTAlignment write SetLTAlignment;
property Name;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property RangeHigh: double
read FMaximum write SetRangeHigh nodefault;
property RangeLow: double
read FMinimum write SetRangeLow nodefault;
property ReadOnly: boolean read FReadOnly write SetReadOnly;
property RightText: string read FRightText write SetRightText;
property RightTextAlignment: TAlignment
read FRTAlignment write SetRTAlignment;
property ShowHint;
property SignificantDigits: integer read FSigDig write SetSigDig;
{$IFDEF GE_LEV17}
(**) property StyleElements;
{$ENDIF}
property TabOrder;
property TabStop;
property Tag;
property Text: string read FInBuffer write SetNioText;
property TextBoxWidth: integer
read FTextBoxWidth write SetTextBoxWidth;
property Top;
property Value: double read GetNioValue write SetNioValue;
property Visible;
property Width;
property OnClick;
property OnDblClick;
property OnMouseMove;
property OnMouseDown;
property OnMouseUp;
property OnKeyPress;
property OnKeyUp;
property OnKeyDown;
property OnEnter;
property OnExit;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
property OnGaugeChange: TOnGaugeChangeEvent
read FOnGaugeChange write FOnGaugeChange;
end;
|