EhLib.Com
https://forum.ehlib.com/en/

ALLOWGRAYED
https://forum.ehlib.com/en/viewtopic.php?f=5&t=789
Page 1 of 1

Author:  WALLOON [ 25 Oct 2017, 10:03 ]
Post subject:  ALLOWGRAYED

Hello,
I have an application where the null values in the dbcheckboxeh must be true or false.
The customer doesn't want to see grayed checkboxes nor in dbgrideh and not in dbcheckboxeh ?
I set the allowgrayed value to true but if the value is null in the field - the checkboxes are still grayed.
Is there a way to do that?
Regards.

Remy

------------
Actually I have done the requirement of the customer by modification in the source code. I'm looking for something better and smarter :)

function TCustomDBCheckBoxEh.GetFieldState: TCheckBoxState;
var
Text: string;
begin
if FDatalink.DataIndepended then
begin
Result := cbGrayed;
if VarEquals(FDatalink.DataIndependentValue, True) then
Result := cbChecked
else if VarEquals(FDatalink.DataIndependentValue, False) then
Result := cbUnchecked;
end else if FDatalink.Field <> nil then
if (FDataLink.Field.DataType = ftBoolean) and
(FValueCheck = STextTrue) and
(FValueUncheck = STextFalse) then
begin
if FDataLink.Field.IsNull then
Result := cbUnchecked {REMY cbGrayed}
else if FDataLink.Field.AsBoolean then
Result := cbChecked
else
Result := cbUnchecked
end else
begin
Result := cbGrayed;
Text := FDataLink.Field.Text;
if ValueMatch(FValueCheck, Text) then Result := cbChecked else
if ValueMatch(FValueUncheck, Text) then Result := cbUnchecked;
end
else
Result := cbUnchecked;
end;

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/