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;