Good afternoon, I'm loading boolean fields from my database into TValueListEditor to manipulate some system permissions. Using the code:
procedure TfrmUser.LoadPermissions;
var
i: Integer;
begin
vlePermissions.Strings.BeginUpdate;
try
vlePermissions.Strings.Clear;
for i := 0 to dsProfiles.DataSet.FieldCount - 1 do
begin
if dsProfiles.DataSet.Fields[i].DataType = ftBoolean then
begin
vlePermissoes.InsertRow(dsProfiles.DataSet.Fields[i].FieldName, BoolToStr(dsProfiles.DataSet.Fields[i].AsBoolean, True), True);
with vlePermissions.ItemProps[dsProfiles.DataSet.Fields[i].FieldName] do
begin
EditStyle := esPickList;
ReadOnly := True;
PickList.Add('True');
PickList.Add('False');
end;
end;
end;
finally
vlePermissions.Strings.EndUpdate;
end;
end;
The compiler displays this warning
uuser.pas(1163,76) Note: Call to subroutine "operator :=(const source:ShortString):Variant;" marked as inline is not inlined
When I try to call the procedure to load the data it shows an exception and terminates.
To save the change in the bank I am using:
procedure TfrmUser.vlePermissionsSetEditText(Sender: TObject; ACol,
ARow: Integer; const Value: string);
var
Field: TField;
begin
if dsProfiles.DataSet.State in [dsEdit, dsInsert] then
begin
Field := dsProfiles.DataSet.FieldByName(vlePermissions.Keys[ARow]);
if Assigned(Field) and (Field.DataType = ftBoolean) then
Field.AsBoolean := StrToBoolDef(Value, True);
end;
end;
Has anyone done something similar and can give me a solution?