Browse Source

+ Commented out Debug-procedure DumpMem
+ implemented TField.Text
+ fixed TField.CanModify
+ implemented TDataset.CheckBiDirectional
+ Fixed TDataset.FilterOptions
+ implemented TDataset.SetFound

git-svn-id: trunk@3215 -

joost 19 years ago
parent
commit
56ac885f84
3 changed files with 38 additions and 13 deletions
  1. 13 6
      fcl/db/dataset.inc
  2. 6 5
      fcl/db/db.pp
  3. 19 2
      fcl/db/fields.inc

+ 13 - 6
fcl/db/dataset.inc

@@ -991,10 +991,17 @@ begin
   //!! To be implemented
   //!! To be implemented
 end;
 end;
 
 
+Procedure TDataset.CheckBiDirectional;
+
+begin
+  if FIsUniDirectional then DataBaseError(SUniDirectional);
+end;
+
 Procedure TDataset.SetFilterOptions(Value: TFilterOptions);
 Procedure TDataset.SetFilterOptions(Value: TFilterOptions);
 
 
 begin
 begin
-  //!! To be implemented
+  CheckBiDirectional;
+  FFilterOptions := Value;
 end;
 end;
 
 
 Procedure TDataset.SetFilterText(const Value: string);
 Procedure TDataset.SetFilterText(const Value: string);
@@ -1012,7 +1019,7 @@ end;
 Procedure TDataset.SetFound(const Value: Boolean);
 Procedure TDataset.SetFound(const Value: Boolean);
 
 
 begin
 begin
-  //!! To be implemented
+  FFound := Value;
 end;
 end;
 
 
 Procedure TDataset.SetModified(Value: Boolean);
 Procedure TDataset.SetModified(Value: Boolean);
@@ -1054,7 +1061,8 @@ end;
 Procedure TDataset.SetOnFilterRecord(const Value: TFilterRecordEvent);
 Procedure TDataset.SetOnFilterRecord(const Value: TFilterRecordEvent);
 
 
 begin
 begin
-  //!! To be implemented
+  CheckBiDirectional;
+  FOnFilterRecord := Value;
 end;
 end;
 
 
 Procedure TDataset.SetRecNo(Value: Longint);
 Procedure TDataset.SetRecNo(Value: Longint);
@@ -1637,7 +1645,7 @@ Var
   Function ScrollBackward : Integer;
   Function ScrollBackward : Integer;
 
 
   begin
   begin
-    if FIsUniDirectional then DatabaseError(SUniDirectional);
+    CheckBiDirectional;
     Result:=0;
     Result:=0;
 {$ifdef dsdebug}
 {$ifdef dsdebug}
     Writeln('Scrolling backward:',Abs(Distance));
     Writeln('Scrolling backward:',Abs(Distance));
@@ -1989,8 +1997,7 @@ end;
 Function TDataset.Locate(const keyfields: string; const keyvalues: Variant; options: TLocateOptions) : boolean;
 Function TDataset.Locate(const keyfields: string; const keyvalues: Variant; options: TLocateOptions) : boolean;
 
 
 begin
 begin
-  if fIsUnidirectional then
-    DataBaseError(SUniDirectional);
+  CheckBiDirectional;
   Result := False;
   Result := False;
 end;
 end;
 
 

+ 6 - 5
fcl/db/db.pp

@@ -218,7 +218,6 @@ type
     FAlignMent : TAlignment;
     FAlignMent : TAlignment;
     FAttributeSet : String;
     FAttributeSet : String;
     FCalculated : Boolean;
     FCalculated : Boolean;
-    FCanModify : Boolean;
     FConstraintErrorMessage : String;
     FConstraintErrorMessage : String;
     FCustomConstraint : String;
     FCustomConstraint : String;
     FDataSet : TDataSet;
     FDataSet : TDataSet;
@@ -227,7 +226,6 @@ type
     FDefaultExpression : String;
     FDefaultExpression : String;
     FDisplayLabel : String;
     FDisplayLabel : String;
     FDisplayWidth : Longint;
     FDisplayWidth : Longint;
-    FEditText : String;
     FFieldKind : TFieldKind;
     FFieldKind : TFieldKind;
     FFieldName : String;
     FFieldName : String;
     FFieldNo : Longint;
     FFieldNo : Longint;
@@ -260,6 +258,8 @@ type
     procedure SetIndex(AValue: Integer);
     procedure SetIndex(AValue: Integer);
     Procedure SetDataset(AValue : TDataset);
     Procedure SetDataset(AValue : TDataset);
     function GetDisplayText: String;
     function GetDisplayText: String;
+    function GetEditText: String;
+    procedure SetEditText(const AValue: string);
     procedure SetDisplayLabel(const AValue: string);
     procedure SetDisplayLabel(const AValue: string);
     procedure SetDisplayWidth(const AValue: Longint);
     procedure SetDisplayWidth(const AValue: Longint);
     function GetDisplayWidth: integer;
     function GetDisplayWidth: integer;
@@ -337,7 +337,7 @@ type
     property AsVariant: variant read GetAsVariant write SetAsVariant;
     property AsVariant: variant read GetAsVariant write SetAsVariant;
     property AttributeSet: string read FAttributeSet write FAttributeSet;
     property AttributeSet: string read FAttributeSet write FAttributeSet;
     property Calculated: Boolean read FCalculated write FCalculated;
     property Calculated: Boolean read FCalculated write FCalculated;
-    property CanModify: Boolean read FCanModify;
+    property CanModify: Boolean read GetCanModify;
     property CurValue: Variant read GetCurValue;
     property CurValue: Variant read GetCurValue;
     property DataSet: TDataSet read FDataSet write SetDataSet;
     property DataSet: TDataSet read FDataSet write SetDataSet;
     property DataSize: Word read GetDataSize;
     property DataSize: Word read GetDataSize;
@@ -350,7 +350,7 @@ type
     property NewValue: Variant read GetNewValue write SetNewValue;
     property NewValue: Variant read GetNewValue write SetNewValue;
     property Offset: word read FOffset;
     property Offset: word read FOffset;
     property Size: Word read FSize write FSize;
     property Size: Word read FSize write FSize;
-    property Text: string read FEditText write FEditText;
+    property Text: string read GetEditText write SetEditText;
     property ValidChars : TFieldChars Read FValidChars;
     property ValidChars : TFieldChars Read FValidChars;
     property Value: variant read GetAsVariant write SetAsVariant;
     property Value: variant read GetAsVariant write SetAsVariant;
     property OldValue: variant read GetOldValue;
     property OldValue: variant read GetOldValue;
@@ -985,6 +985,7 @@ type
     procedure CalculateFields(Buffer: PChar); virtual;
     procedure CalculateFields(Buffer: PChar); virtual;
     procedure CheckActive; virtual;
     procedure CheckActive; virtual;
     procedure CheckInactive; virtual;
     procedure CheckInactive; virtual;
+    procedure CheckBiDirectional;
     procedure Loaded; override;
     procedure Loaded; override;
     procedure ClearBuffers; virtual;
     procedure ClearBuffers; virtual;
     procedure ClearCalcFields(Buffer: PChar); virtual;
     procedure ClearCalcFields(Buffer: PChar); virtual;
@@ -1166,7 +1167,7 @@ type
     property FieldValues[fieldname : string] : Variant read GetFieldValues write SetFieldValues; default;
     property FieldValues[fieldname : string] : Variant read GetFieldValues write SetFieldValues; default;
     property Filter: string read FFilterText write SetFilterText;
     property Filter: string read FFilterText write SetFilterText;
     property Filtered: Boolean read FFiltered write SetFiltered default False;
     property Filtered: Boolean read FFiltered write SetFiltered default False;
-    property FilterOptions: TFilterOptions read FFilterOptions write FFilterOptions;
+    property FilterOptions: TFilterOptions read FFilterOptions write SetFilterOptions;
     property Active: Boolean read GetActive write SetActive default False;
     property Active: Boolean read GetActive write SetActive default False;
     property AutoCalcFields: Boolean read FAutoCalcFields write FAutoCalcFields;
     property AutoCalcFields: Boolean read FAutoCalcFields write FAutoCalcFields;
     property BeforeOpen: TDataSetNotifyEvent read FBeforeOpen write FBeforeOpen;
     property BeforeOpen: TDataSetNotifyEvent read FBeforeOpen write FBeforeOpen;

+ 19 - 2
fcl/db/fields.inc

@@ -13,7 +13,7 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
-Procedure DumpMem (P : Pointer;Size : Longint);
+{Procedure DumpMem (P : Pointer;Size : Longint);
 
 
 Var i : longint;
 Var i : longint;
 
 
@@ -22,7 +22,7 @@ begin
   For I:=0 to Size-1 do
   For I:=0 to Size-1 do
     Write (Pbyte(P)[i],' ');
     Write (Pbyte(P)[i],' ');
   Writeln;
   Writeln;
-end;
+end;}
 
 
 { ---------------------------------------------------------------------
 { ---------------------------------------------------------------------
     TFieldDef
     TFieldDef
@@ -879,6 +879,23 @@ end;
 
 
 // TField private methods
 // TField private methods
 
 
+procedure TField.SetEditText(const AValue: string);
+begin
+  if Assigned(OnSetText) then
+    OnSetText(Self, AValue)
+  else
+    SetText(AValue);
+end;
+
+function TField.GetEditText: String;
+begin
+  SetLength(Result, 0);
+  if Assigned(OnGetText) then
+    OnGetText(Self, Result, False)
+  else
+    GetText(Result, False);
+end;
+
 function TField.GetDisplayText: String;
 function TField.GetDisplayText: String;
 begin
 begin
   SetLength(Result, 0);
   SetLength(Result, 0);