Skip to content

Instantly share code, notes, and snippets.

@dario61081
Created July 28, 2017 20:39
Show Gist options
  • Select an option

  • Save dario61081/63398f62fba7ddf31cc7544b0fd6b5e7 to your computer and use it in GitHub Desktop.

Select an option

Save dario61081/63398f62fba7ddf31cc7544b0fd6b5e7 to your computer and use it in GitHub Desktop.
Uso del gettext settext de un tfield
procedure TForm1.Table1CategoryGetText(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
case Sender.AsInteger of
1: Text := 'Electrical';
2: Text := 'Agricultural';
else
Text := '[Error]';
end;
end;
procedure TForm1.Table1CategorySetText(Sender: TField;
const Text: String);
begin
if Text = 'Electrical'then
Sender.Value := 1
else if Text = 'Agricultural' then
Sender.Value := 2
else
raise Exception.Create ('Error in Category field conversion');
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment