You've already forked lazarus-ccr
Release 0.1.6 (20070704):
Fix for TO32TCFlexEdit validation; 3 new example programs (TestSpinner, TestSimpField, TestTblEdits); updated OrphStatus.html notes. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@204 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
67
components/orpheus/tests/TestSimpField/unit1.pas
Normal file
67
components/orpheus/tests/TestSimpField/unit1.pas
Normal file
@@ -0,0 +1,67 @@
|
||||
unit Unit1;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFNDEF LCL} Windows, Messages, {$ELSE} LclIntf, LMessages, LclType, LResources, {$ENDIF}
|
||||
SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ovcbase, ovcdata, ovcef, ovcsf;
|
||||
|
||||
type
|
||||
TForm1 = class(TForm)
|
||||
Label1: TLabel;
|
||||
OvcSimpleField1: TOvcSimpleField;
|
||||
Label2: TLabel;
|
||||
OvcSimpleField2: TOvcSimpleField;
|
||||
procedure OvcSimpleField1UserValidation(Sender: TObject;
|
||||
var ErrorCode: Word);
|
||||
procedure OvcSimpleFieldError(Sender: TObject; ErrorCode: Word;
|
||||
ErrorMsg: String);
|
||||
procedure OvcSimpleField2UserValidation(Sender: TObject;
|
||||
var ErrorCode: Word);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$IFNDEF LCL}
|
||||
{$R *.dfm}
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
procedure TForm1.OvcSimpleField1UserValidation(Sender: TObject;
|
||||
var ErrorCode: Word);
|
||||
begin
|
||||
ErrorCode := 0;
|
||||
if (TOvcSimpleField(Sender).Text <> '') and
|
||||
(StrToIntDef(TOvcSimpleField(Sender).Text, 0) <= 0) then
|
||||
ErrorCode := oeInvalidNumber;
|
||||
end;
|
||||
|
||||
procedure TForm1.OvcSimpleFieldError(Sender: TObject; ErrorCode: Word;
|
||||
ErrorMsg: String);
|
||||
begin
|
||||
MessageDlg(ErrorMsg + #13#10 + 'Press Ctrl+Z to undo.', mtError, [mbOK], 0);
|
||||
end;
|
||||
|
||||
procedure TForm1.OvcSimpleField2UserValidation(Sender: TObject;
|
||||
var ErrorCode: Word);
|
||||
begin
|
||||
ErrorCode := 0;
|
||||
if (TOvcSimpleField(Sender).Text <> '') and
|
||||
(StrToFloatDef(TOvcSimpleField(Sender).Text, 0) <= 0) then
|
||||
ErrorCode := oeInvalidNumber;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$IFDEF LCL}
|
||||
{$I unit1.lrs} {Include form's resource file}
|
||||
{$ENDIF}
|
||||
|
||||
end.
|
Reference in New Issue
Block a user