* Patch from Paul Ishenin to fix several Delphi-incompatilibities:

- Make TField.SetDataset virtual
  - Pass SetVariant argument as const
  - Add TField.Lookup property
  - Add TDataset.SetDefaultsField protected method

git-svn-id: trunk@11129 -
This commit is contained in:
joost 2008-05-29 19:02:23 +00:00
parent a33023e384
commit 826ffc899f
3 changed files with 30 additions and 9 deletions

View File

@ -1177,6 +1177,11 @@ begin
end;
end;
procedure TDataSet.SetDefaultFields(const Value: Boolean);
begin
FDefaultFields := Value;
end;
Procedure TDataset.SetField (Index : Longint;Value : TField);
begin

View File

@ -257,8 +257,8 @@ type
{ TField }
TField = class(TComponent)
Private
FAlignMent : TAlignment;
private
FAlignment : TAlignment;
FAttributeSet : String;
FCalculated : Boolean;
FConstraintErrorMessage : String;
@ -296,16 +296,17 @@ type
FValidating : Boolean;
FVisible : Boolean;
FProviderFlags : TProviderFlags;
Function GetIndex : longint;
function GetIndex : longint;
function GetLookup: Boolean;
procedure SetAlignment(const AValue: TAlignMent);
procedure SetIndex(const AValue: Integer);
Procedure SetDataset(AValue : TDataset);
function GetDisplayText: String;
function GetEditText: String;
procedure SetEditText(const AValue: string);
procedure SetDisplayLabel(const AValue: string);
procedure SetDisplayWidth(const AValue: Longint);
function GetDisplayWidth: integer;
procedure SetLookup(const AValue: Boolean);
procedure SetReadOnly(const AValue: Boolean);
procedure SetVisible(const AValue: Boolean);
function IsDisplayStored : Boolean;
@ -350,9 +351,10 @@ type
procedure SetAsLongint(AValue: Longint); virtual;
procedure SetAsInteger(AValue: Integer); virtual;
procedure SetAsLargeint(AValue: Largeint); virtual;
procedure SetAsVariant(AValue: variant); virtual;
procedure SetAsVariant(const AValue: variant); virtual;
procedure SetAsString(const AValue: string); virtual;
procedure SetAsWideString(const aValue: WideString); virtual;
procedure SetDataset(AValue : TDataset); virtual;
procedure SetDataType(AValue: TFieldType);
procedure SetNewValue(const AValue: Variant);
procedure SetSize(AValue: Word); virtual;
@ -406,7 +408,7 @@ type
property OldValue: variant read GetOldValue;
property LookupList: TLookupList read GetLookupList;
published
property AlignMent : TAlignMent Read FAlignMent write SetAlignment default taLeftJustify;
property Alignment : TAlignment read FAlignment write SetAlignment default taLeftJustify;
property CustomConstraint: string read FCustomConstraint write FCustomConstraint;
property ConstraintErrorMessage: string read FConstraintErrorMessage write FConstraintErrorMessage;
property DefaultExpression: string read FDefaultExpression write FDefaultExpression;
@ -417,11 +419,12 @@ type
property HasConstraints: Boolean read FHasConstraints;
property Index: Longint read GetIndex write SetIndex;
property ImportedConstraint: string read FImportedConstraint write FImportedConstraint;
property KeyFields: string read FKeyFields write FKeyFields;
property Lookup: Boolean read GetLookup write SetLookup;
property LookupCache: Boolean read FLookupCache write FLookupCache;
property LookupDataSet: TDataSet read FLookupDataSet write FLookupDataSet;
property LookupKeyFields: string read FLookupKeyFields write FLookupKeyFields;
property LookupResultField: string read FLookupResultField write FLookupResultField;
property KeyFields: string read FKeyFields write FKeyFields;
property LookupCache: Boolean read FLookupCache write FLookupCache;
property Origin: string read FOrigin write FOrigin;
property ProviderFlags : TProviderFlags read FProviderFlags write FProviderFlags;
property ReadOnly: Boolean read FReadOnly write SetReadOnly;
@ -1203,6 +1206,7 @@ type
procedure SetBufListSize(Value: Longint); virtual;
procedure SetChildOrder(Component: TComponent; Order: Longint); override;
procedure SetCurrentRecord(Index: Longint); virtual;
procedure SetDefaultFields(const Value: Boolean);
procedure SetFiltered(Value: Boolean); virtual;
procedure SetFilterOptions(Value: TFilterOptions); virtual;
procedure SetFilterText(const Value: string); virtual;

View File

@ -608,6 +608,11 @@ begin
Result:=-1;
end;
function TField.GetLookup: Boolean;
begin
Result := FieldKind = fkLookup;
end;
function TField.GetAsLargeInt: LargeInt;
begin
Raise AccessError(SLargeInt);
@ -742,7 +747,7 @@ begin
Raise AccessError(SFloat);
end;
procedure TField.SetAsVariant(AValue: Variant);
procedure TField.SetAsVariant(const AValue: Variant);
begin
if VarIsNull(AValue) then
@ -939,6 +944,13 @@ begin
result:=FDisplayWidth;
end;
procedure TField.SetLookup(const AValue: Boolean);
const
ValueToLookupMap: array[Boolean] of TFieldKind = (fkData, fkLookup);
begin
FieldKind := ValueToLookupMap[AValue];
end;
procedure TField.SetReadOnly(const AValue: Boolean);
begin
if (FReadOnly<>Avalue) then