RxFPC:RxDBGrid - check numeric field MinValue and MaxValue on RxDBGrid rxUpDown editor

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7386 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2020-04-15 22:28:52 +00:00
parent 5cdb8c16c7
commit 79e39c6318

View File

@ -2533,6 +2533,7 @@ var
Col:TRxColumn;
msg: TGridMessage;
V: Boolean;
begin
Col:=TRxColumnEditButtons(Collection).FOwner as TRxColumn;
F:=Col.Field;
@ -2545,6 +2546,15 @@ begin
if F.IsNull then
F.Value:=0;
if F is TLongintField then
V:=(TLongintField(F).MinValue <> 0) and (TLongintField(F).MaxValue <> 0) and (TLongintField(F).MinValue < F.Value)
else
if F is TFloatField then
V:=(TFloatField(F).MinValue <> 0) and (TFloatField(F).MaxValue <> 0) and (TFloatField(F).MinValue < F.Value)
else
V:=true;
if V then
F.Value:=F.Value - 1;
Msg.LclMsg.msg:=GM_SETVALUE;
@ -2561,6 +2571,7 @@ var
Col:TRxColumn;
msg: TGridMessage;
V: Boolean;
begin
Col:=TRxColumnEditButtons(Collection).FOwner as TRxColumn;
F:=Col.Field;
@ -2572,6 +2583,16 @@ begin
if F.IsNull then
F.Value:=0;
if F is TLongintField then
V:=(TLongintField(F).MinValue <> 0) and (TLongintField(F).MaxValue <> 0) and (TLongintField(F).MaxValue > F.Value)
else
if F is TFloatField then
V:=(TFloatField(F).MinValue <> 0) and (TFloatField(F).MaxValue <> 0) and (TFloatField(F).MaxValue < F.Value)
else
V:=true;
if V then
F.Value:=F.Value + 1;
Msg.LclMsg.msg:=GM_SETVALUE;