Hi !
Could you please make 2 tiny changes in DBInspectorBar.pas
, so we'll be able to use integer
fields as Boolean
fields (1=True, 0=False) with the ptBoolean
PropertyType
and take benefit of the inspector checkboxes feature without implementing customized & weird methods/events?
Currently, when PropertyType = ptBoolea
n it only works well if the field is a TBooleanField
, but it's not always a choice. And the DataLink
methods only check the datafield kind, not the PropertyType
of the TDBInspectorItem
.
I could achieve it with 2 simple changes in methods DataChange
& DataUpdate
:
procedure TDBInspectorItem.DataChange(Sender: TObject);
...
...
begin
...
...
case FDataLink.Field.DataType of
ftSmallInt,ftInteger,ftWord:
begin
{ new check }
if PropertyType = ptBoolean then begin
BoolValue := (FDataLink.Field.AsInteger <> 0);
end else begin
{ just as it was before }
IntValue := FDataLink.Field.AsInteger;
TextValue := FDataLink.Field.DisplayText;
end;
end;
procedure TDBInspectorItem.DataUpdate(Sender: TObject);
begin
...
...
case FDataLink.Field.DataType of
ftSmallInt,ftInteger,ftWord:
{ new check }
if PropertyType = ptBoolean then begin
{ didn't use "IfThen" because I didn't want to change the "uses" clause }
if BoolValue then
FDataLink.Field.AsInteger := 1
else
FDataLink.Field.AsInteger := 0;
end else
{ as before }
FDataLink.Field.AsInteger := IntValue;
Could you please take into consideration adding these changes?
Thanks.