[Overview][Resource strings][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'tiObject' (#tiopf)

TtiObject.GetFieldBounds

Get the minimum and maximum values for a property

Declaration

Source position: tiObject.pas line 482

public function TtiObject.GetFieldBounds(

  const AFieldName: string;

  out MinValue: Integer;

  out MaxValue: Integer

):Boolean; overload;

function TtiObject.GetFieldBounds(

  const AFieldName: string;

  out MinValue: Extended;

  out MaxValue: Extended

):Boolean; overload;

function TtiObject.GetFieldBounds(

  const AFieldName: string;

  out MinValue: TDateTime;

  out MaxValue: TDateTime

):Boolean; overload;

Description

Get the minimum and maximum values for a property. Returns false if there are no bounds. For string fields, this is the min and max length.

Example

procedure TPerson.DoGetFieldBounds(const AFieldName: String; var MinValue,
  MaxValue: Integer; var HasBounds: Boolean);
begin
  if AFieldName = 'Name' then
  begin
    // Name property limited to max length of 25 characters
    HasBounds := True;
    MinValue := 1;
    MaxValue := 25;
  end
  else if AFieldName = 'Age' then
  begin
    // Age property limited to a value between 1 and 120
    HasBounds := True;
    MinValue := 1;
    MaxValue := 120;
  end
  else
    inherited DoGetFieldBounds(AFieldName, MinValue, MaxValue, HasBounds);
end;


Documentation generated on: 2017-08-16