Class TRkDBSpinEdit (unit RkDBSpin)

Inherits from

TSpinEdit

Constructors


constructor Create( AOwner : TComponent );

===========================} {== TRkDBSpinEdit Methods ==} {===========================


Functions

destructor Destroy;

Assign event handlers

procedure Change;


procedure DownClick( Sender : TObject );

Increment only if in edit mode

procedure KeyDown( var Key : Word; Shift : TShiftState );

Tell the FDataLink that the data has changed

procedure KeyPress( var Key : Char );

Need to handle Old Fashioned Cut, Paste, and Delete keystrokes

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


procedure UpClick( Sender : TObject );

Escape key pressed

procedure ActiveChange( Sender : TObject );

========================================================================= TRkDBSpinEdit.

procedure CheckFieldType( const Value : string );

========================================================================= TRkDBSpinEdit.

procedure CMEnter( var Msg : TCMEnter );

Because Alignment automatically reverts back to taLeftJustify when control gets the focus, the control must be repainted, when the focus changes.

procedure CMExit( var Msg : TCMExit );


procedure CMFontChanged( var Msg : TMessage );

Reraise the exception

procedure DataChange( Sender : TObject );

========================================================================= TRkDBSpinEdit.

procedure EditingChange( Sender : TObject );

========================================================================= TRkDBSpinEdit.

function GetDataField : string;


function GetDataSource : TDataSource;

Check that field type is Integer

function GetReadOnly : Boolean;


procedure SetDataField( const Value : string );


procedure SetDataSource( Value : TDataSource );


procedure SetReadOnly( Value : Boolean );


procedure UpdateData( Sender : TObject );

= TRkDBSpinEdit.

procedure UpdateFocus( Value : Boolean );

Draw the text

procedure WMCut( var Msg : TMessage );

EditorEnabled is defined in TSpinEdit

procedure WMPaint( var Msg : TWMPaint );

========================================================================= TRkDBSpinEdit.

procedure WMPaste( var Msg : TMessage );

========================================================================= Both the WMPaste and WMCut methods had to be copied from the TSpinEdit class because placing the Dataset into Edit mode must come before altering the text, but after checking for ReadOnly.

Properties

property About : TRkAboutInfo


property BorderStyle :

Inherited Properties

property DataField : string


property DataSource : TDataSource


property ReadOnly : Boolean

This property controls the ReadOnly state of the DataLink

property Width :


Events

Variables

FAboutInfo : TRkAboutInfo;


FAlignment : TAlignment;


FCanvas : TControlCanvas;


FDataLink : TFieldDataLink;


FDisplayText : string;


FFocused : Boolean;



Constructors


constructor Create( AOwner : TComponent );

===========================} {== TRkDBSpinEdit Methods ==} {===========================


Functions


destructor Destroy;

Assign event handlers


procedure Change;


procedure DownClick( Sender : TObject );

Increment only if in edit mode


procedure KeyDown( var Key : Word; Shift : TShiftState );

Tell the FDataLink that the data has changed


procedure KeyPress( var Key : Char );

Need to handle Old Fashioned Cut, Paste, and Delete keystrokes


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


procedure UpClick( Sender : TObject );

Escape key pressed


procedure ActiveChange( Sender : TObject );

========================================================================= TRkDBSpinEdit.ActiveChange This method gets called whenever the Active property of the attached Dataset changes. NOTE: You can use the FDataLink.Active property to determine the *new* state of the Dataset. =========================================================================


procedure CheckFieldType( const Value : string );

========================================================================= TRkDBSpinEdit.CheckFieldType This method checks to make sure the field type corresponding to the column referenced by Value is either ftInteger, ftSmallInt, or ftWord. If it is not, then an EInvalidFieldType exception is raised. =========================================================================


procedure CMEnter( var Msg : TCMEnter );

Because Alignment automatically reverts back to taLeftJustify when control gets the focus, the control must be repainted, when the focus changes.


procedure CMExit( var Msg : TCMExit );


procedure CMFontChanged( var Msg : TMessage );

Reraise the exception


procedure DataChange( Sender : TObject );

========================================================================= TRkDBSpinEdit.DataChange This method gets called as a result of a number of different events: 1. The underlying field value changes. Occurs when changing the value of the column tied to this control and then move to a new column or a new record. 2. The corresponding Dataset goes into Edit mode. 3. The corresponding Dataset referenced by DataSource changes. 4. The current cursor is scrolled to a new record in the table. 5. The record is reset through a Cancel call. 6. The DataField property changes to reference another column. =========================================================================


procedure EditingChange( Sender : TObject );

========================================================================= TRkDBSpinEdit.EditingChange This method gets called when the State of the attached Dataset (via the DataSource) changes between an Editing state and a Non-Editing state. The different states are described below: Editing States Non-Editing States -------------- ------------------ dsEdit dsInactive dsInsert dsBrowse dsSetKey dsCalcFields NOTE: This method only gets called if the DataLink is not ReadOnly. =========================================================================


function GetDataField : string;


function GetDataSource : TDataSource;

Check that field type is Integer


function GetReadOnly : Boolean;


procedure SetDataField( const Value : string );


procedure SetDataSource( Value : TDataSource );


procedure SetReadOnly( Value : Boolean );


procedure UpdateData( Sender : TObject );

= TRkDBSpinEdit.DataChange =} {========================================================================= TRkDBSpinEdit.UpdateData This method gets called when the corresponding field value and the contents of the SpinEdit need to be synchronized. Note that this method only gets called if this control was responsible for altering the data. =========================================================================


procedure UpdateFocus( Value : Boolean );

Draw the text


procedure WMCut( var Msg : TMessage );

EditorEnabled is defined in TSpinEdit


procedure WMPaint( var Msg : TWMPaint );

========================================================================= TRkDBSpinEdit.WMPaint This method takes a trick provided in the DBCtrls unit for handling the display of right justified text into an edit field. If the text needs to be drawn right-justified, then the text is drawn manually. Otherwise, the default message handler handles it. The contents are always drawn left-justified when the control has the focus. =========================================================================


procedure WMPaste( var Msg : TMessage );

========================================================================= Both the WMPaste and WMCut methods had to be copied from the TSpinEdit class because placing the Dataset into Edit mode must come before altering the text, but after checking for ReadOnly. =========================================================================


Properties


property About : TRkAboutInfo


property BorderStyle :

Inherited Properties


property DataField : string


property DataSource : TDataSource


property ReadOnly : Boolean

This property controls the ReadOnly state of the DataLink


property Width :


Events


Variables


FAboutInfo : TRkAboutInfo;


FAlignment : TAlignment;


FCanvas : TControlCanvas;


FDataLink : TFieldDataLink;


FDisplayText : string;


FFocused : Boolean;