From: <jcm...@us...> - 2006-02-05 14:42:27
|
Revision: 582 Author: jcmoraisjr Date: 2006-02-05 06:41:54 -0800 (Sun, 05 Feb 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=582&view=rev Log Message: ----------- Fixed bug # 1410138 where in some situations a Selector raises an exception because database component name wasn't uploaded from stream. Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-02-05 14:25:24 UTC (rev 581) +++ trunk/Source/Core/InstantPresentation.pas 2006-02-05 14:41:54 UTC (rev 582) @@ -4303,7 +4303,8 @@ else FQuery := Connector.CreateQuery; FQuery.MaxCount := MaxCount; - FQuery.Command := Command.Text; + if not (csReading in ComponentState) then + FQuery.Command := Command.Text; end; Result := FQuery; end; |
From: <sr...@us...> - 2006-02-13 07:25:54
|
Revision: 585 Author: srmitch Date: 2006-02-12 23:25:37 -0800 (Sun, 12 Feb 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=585&view=rev Log Message: ----------- Fix for SF BT #1426929 bug report. For an application compiled in D2006, adding entries into a new record in a DbGrid with an attached Selector results in an application crash (stack overflow) when trying to tab from the second column. Workaround comprises the addition of a semaphore variable to avoid recursion. Changes to InstantPresentation.pas: TInstantCustomExposer = class(TDataSet) private ... FContentModifiedList: TList; + FInSetFieldData: Boolean; FMemoList: TStrings; ... end; procedure TInstantCustomExposer.SetFieldData(Field: TField; Buffer: Pointer); begin if Assigned(Buffer) then Move(Buffer^, CurrentBuffer[GetFieldOffset(Field)], Field.DataSize) else FillChar(CurrentBuffer[GetFieldOffset(Field)], Field.DataSize, 0); - if not (State in [dsCalcFields, dsInternalCalc, dsFilter, dsNewValue]) then + if not (State in [dsCalcFields, dsInternalCalc, dsFilter, dsNewValue]) and + not FInSetFieldData then begin + FInSetFieldData := True; + try PostField(Field); DataEvent(deFieldChange, Longint(Field)); + finally + FInSetFieldData := False; + end; end; end; Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-02-13 07:09:19 UTC (rev 584) +++ trunk/Source/Core/InstantPresentation.pas 2006-02-13 07:25:37 UTC (rev 585) @@ -218,6 +218,7 @@ FAfterPostField: TInstantFieldEvent; FBeforePostField: TInstantFieldEvent; FContentModifiedList: TList; + FInSetFieldData: Boolean; FMemoList: TStrings; FOnCompare: TInstantCompareObjectsEvent; FOnCreateObject: TInstantCreateObjectEvent; @@ -2011,8 +2012,7 @@ Result := Accessor.CreateObject; end; -procedure TInstantCustomExposer.DataEvent(Event: TDataEvent; - Info: Integer); +procedure TInstantCustomExposer.DataEvent(Event: TDataEvent; Info: Longint); var I: Integer; DataSet: TDataSet; @@ -3742,10 +3742,16 @@ Move(Buffer^, CurrentBuffer[GetFieldOffset(Field)], Field.DataSize) else FillChar(CurrentBuffer[GetFieldOffset(Field)], Field.DataSize, 0); - if not (State in [dsCalcFields, dsInternalCalc, dsFilter, dsNewValue]) then + if not (State in [dsCalcFields, dsInternalCalc, dsFilter, dsNewValue]) and + not FInSetFieldData then begin - PostField(Field); - DataEvent(deFieldChange, Longint(Field)); + FInSetFieldData := True; + try + PostField(Field); + DataEvent(deFieldChange, Longint(Field)); + finally + FInSetFieldData := False; + end; end; end; |
From: <jcm...@us...> - 2006-02-23 17:44:36
|
Revision: 624 Author: jcmoraisjr Date: 2006-02-23 09:44:25 -0800 (Thu, 23 Feb 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=624&view=rev Log Message: ----------- Fixed TInstantSelector.GetConnector, that was retrieving DefaultConnector even in designtime and without select it. Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-02-23 16:55:26 UTC (rev 623) +++ trunk/Source/Core/InstantPresentation.pas 2006-02-23 17:44:25 UTC (rev 624) @@ -4504,7 +4504,7 @@ function TInstantSelector.GetConnector: TInstantConnector; begin - if Assigned(FConnector) then + if Assigned(FConnector) or (csDesigning in ComponentState) then Result := FConnector else Result := InstantDefaultConnector; |
From: <jcm...@us...> - 2006-02-23 18:33:29
|
Revision: 625 Author: jcmoraisjr Date: 2006-02-23 10:33:19 -0800 (Thu, 23 Feb 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=625&view=rev Log Message: ----------- Rolled back change into GetConnector due to AV introduced into designtime package. Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-02-23 17:44:25 UTC (rev 624) +++ trunk/Source/Core/InstantPresentation.pas 2006-02-23 18:33:19 UTC (rev 625) @@ -4504,7 +4504,7 @@ function TInstantSelector.GetConnector: TInstantConnector; begin - if Assigned(FConnector) or (csDesigning in ComponentState) then + if Assigned(FConnector) then Result := FConnector else Result := InstantDefaultConnector; |
From: <sr...@us...> - 2006-02-25 23:29:26
|
Revision: 627 Author: srmitch Date: 2006-02-25 15:29:17 -0800 (Sat, 25 Feb 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=627&view=rev Log Message: ----------- Fix for bug: [1437815] Exposer.RemoveObject messes up TDataSet data. Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-02-25 00:10:30 UTC (rev 626) +++ trunk/Source/Core/InstantPresentation.pas 2006-02-25 23:29:17 UTC (rev 627) @@ -3799,6 +3799,7 @@ Result := InternalRemoveObject(AObject); if Result <> -1 then Refresh; + FRemovedObject := nil; end; procedure TInstantCustomExposer.Reset; |
From: <na...@us...> - 2006-02-28 10:43:59
|
Revision: 635 Author: nandod Date: 2006-02-28 02:43:34 -0800 (Tue, 28 Feb 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=635&view=rev Log Message: ----------- + Fixed Bug # 1439851 - Required fields not checked in Exposers Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-02-28 09:17:36 UTC (rev 634) +++ trunk/Source/Core/InstantPresentation.pas 2006-02-28 10:43:34 UTC (rev 635) @@ -3363,6 +3363,9 @@ AObject: TObject; NewPos: Integer; begin +{$IFDEF D7+} + inherited; +{$ENDIF} AObject := CurrentObject; CopyBufferToObject(ActiveBuffer, AObject); if InContent then |
From: <jcm...@us...> - 2006-02-28 17:59:41
|
Revision: 638 Author: jcmoraisjr Date: 2006-02-28 09:59:30 -0800 (Tue, 28 Feb 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=638&view=rev Log Message: ----------- Fixed bug # 1439091 - Exposer.AddObject duplicating object (sorted lists) Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-02-28 13:37:37 UTC (rev 637) +++ trunk/Source/Core/InstantPresentation.pas 2006-02-28 17:59:30 UTC (rev 638) @@ -1001,8 +1001,6 @@ function TInstantAccessor.AddObject(AObject: TObject): Integer; begin Result := InternalAddObject(AObject); - if Altered then - Result := AddToView(AObject); ChangedData; end; @@ -1307,8 +1305,6 @@ AObject: TObject): Integer; begin Result := InternalInsertObject(Index, AObject); - if Altered then - Result := InsertInView(Index, AObject); ChangedData; end; @@ -1453,8 +1449,6 @@ function TInstantAccessor.RemoveObject(AObject: TObject): Integer; begin Result := InternalRemoveObject(AObject); - if Altered then - Result := RemoveFromView(AObject); ChangedData; end; |
From: <jcm...@us...> - 2006-03-12 20:17:51
|
Revision: 645 Author: jcmoraisjr Date: 2006-03-12 12:17:39 -0800 (Sun, 12 Mar 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=645&view=rev Log Message: ----------- Fixed bug [1446833] - Currency fields receives odd values. Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-03-11 09:13:45 UTC (rev 644) +++ trunk/Source/Core/InstantPresentation.pas 2006-03-12 20:17:39 UTC (rev 645) @@ -3917,6 +3917,7 @@ ftBCD: begin Move(Buffer^, Bcd, SizeOf(Bcd)); + C := 0; BCDToCurr(Bcd,C); Value := C; end; |
From: <jcm...@us...> - 2006-03-15 02:49:45
|
Revision: 650 Author: jcmoraisjr Date: 2006-03-14 18:49:38 -0800 (Tue, 14 Mar 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=650&view=rev Log Message: ----------- - Implemented TInstantCustomExposer.Remove method; - Implemented eoAutoRemember option; - Reverted logic of the eoDisposeReference option, named to eoNotDisposeReference. Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-03-15 02:44:36 UTC (rev 649) +++ trunk/Source/Core/InstantPresentation.pas 2006-03-15 02:49:38 UTC (rev 650) @@ -191,6 +191,7 @@ TInstantDeletedObjectBookmark = record RecNo: Integer; Instance: TInstantObject; + WasDisposed: Boolean; end; PInstantFieldBuffer = ^TInstantFieldBuffer; @@ -212,6 +213,7 @@ procedure FreeFieldBufferList; function GetDeletedObjectInstance: TInstantObject; function GetDeletedObjectRecNo: Integer; + function GetDeletedObjectWasDisposed: Boolean; function GetFieldBuffer(AIndex: Integer): PInstantFieldBuffer; function GetFieldBufferCount: Integer; function GetFieldBufferList: TList; @@ -222,13 +224,14 @@ public constructor Create(AObject: TObject; AOwner: TInstantContentBuffer = nil); destructor Destroy; override; - procedure RegisterAsDeleted(ARecNo: Integer; AAutoApplyChanges, ACanDispose: Boolean); + procedure RegisterAsDeleted(ARecNo: Integer; AAutoApplyChanges, ADispose: Boolean); procedure RegisterAsInserted; procedure RegisterAsModified; procedure RegisterField(AField: TField); procedure UndoChanges; property DeletedObjectInstance: TInstantObject read GetDeletedObjectInstance; property DeletedObjectRecNo: Integer read GetDeletedObjectRecNo; + property DeletedObjectWasDisposed: Boolean read GetDeletedObjectWasDisposed; property FieldBuffer[AIndex: Integer]: PInstantFieldBuffer read GetFieldBuffer; property FieldBufferCount: Integer read GetFieldBufferCount; property IsChanged: Boolean read GetIsChanged; @@ -241,7 +244,6 @@ TInstantContentBuffer = class(TObject) private FAutoApplyChanges: Boolean; - FCanDispose: Boolean; FRecordBufferList: TList; procedure FreeRecordBufferList; function GetRecordBuffer(AIndex: Integer): TInstantRecordBuffer; @@ -250,19 +252,19 @@ protected function FindRecordBuffer(AObject: TObject): TInstantRecordBuffer; function FindRecordBufferIndex(AObject: TObject): Integer; - procedure RegisterObjectUpdate(AObject: TObject; ARecNo: Integer; AUpdateStatus: TUpdateStatus); + procedure RegisterObjectUpdate(AObject: TObject; ARecNo: Integer; ADispose: Boolean; AUpdateStatus: TUpdateStatus); overload; + procedure RegisterObjectUpdate(AObject: TObject; AUpdateStatus: TUpdateStatus); overload; property AutoApplyChanges: Boolean read FAutoApplyChanges; - property CanDispose: Boolean read FCanDispose; property RecordBuffer[AIndex: Integer]: TInstantRecordBuffer read GetRecordBuffer; property RecordBufferCount: Integer read GetRecordBufferCount; property RecordBufferList: TList read GetRecordBufferList; public - constructor Create(AAutoApplyChanges, ACanDispose: Boolean); + constructor Create(AAutoApplyChanges: Boolean); destructor Destroy; override; procedure AddRecordBuffer(ARecordBuffer: TInstantRecordBuffer); procedure DisposeDeletedObjects; procedure ReleaseRecordBuffer(ARecordBuffer: TInstantRecordBuffer); - procedure RegisterAsDeleted(AObject: TObject; ARecNo: Integer); + procedure RegisterAsDeleted(AObject: TObject; ARecNo: Integer; ADispose: Boolean); procedure RegisterAsInserted(AObject: TObject); procedure RegisterAsModified(AObject: TObject; AState: TDataSetState); procedure RevertChanges(AExposer: TInstantCustomExposer); @@ -273,7 +275,7 @@ Instance: TObject; end; - TInstantExposerOption = (eoAutoApply, eoDisposeReferences, eoDeferInsert, eoSyncEdit); + TInstantExposerOption = (eoAutoApply, eoAutoRemember, eoNotDisposeReferences, eoDeferInsert, eoSyncEdit); TInstantExposerOptions = set of TInstantExposerOption; TInstantCustomExposer = class(TDataSet) @@ -507,6 +509,7 @@ procedure RefreshDataView; procedure Remember; procedure ReleaseObject(AObject: TObject); + procedure Remove; function RemoveObject(AObject: TObject): Integer; procedure Reset; procedure Revert; @@ -522,7 +525,7 @@ property FieldOptions: TInstantFieldOptions read FFieldOptions write SetFieldOptions default [foThorough]; property Filtered; property Limited: Boolean read GetLimited write SetLimited default False; - property Options: TInstantExposerOptions read FOptions write SetOptions default [eoAutoApply, eoDisposeReferences]; + property Options: TInstantExposerOptions read FOptions write SetOptions default [eoAutoApply, eoAutoRemember]; property ReadOnly: Boolean read FReadOnly write FReadOnly default False; property Sorted: Boolean read GetSorted write SetSorted default False; property AfterCancel; @@ -1606,6 +1609,11 @@ Result := FDeletedObjectBM.RecNo; end; +function TInstantRecordBuffer.GetDeletedObjectWasDisposed: Boolean; +begin + Result := FDeletedObjectBM.WasDisposed; +end; + function TInstantRecordBuffer.GetFieldBuffer(AIndex: Integer): PInstantFieldBuffer; begin if Assigned(FFieldBufferList) then @@ -1635,7 +1643,7 @@ end; procedure TInstantRecordBuffer.RegisterAsDeleted(ARecNo: Integer; - AAutoApplyChanges, ACanDispose: Boolean); + AAutoApplyChanges, ADispose: Boolean); begin if UpdateStatus = usModified then // Roll back changes, so RevertDeleted will restore the original object @@ -1644,13 +1652,14 @@ begin FDeletedObjectBM.RecNo := ARecNo; FDeletedObjectBM.Instance.Free; - if AAutoApplyChanges and ACanDispose then + if AAutoApplyChanges and ADispose then FDeletedObjectBM.Instance := Subject.Clone else begin FDeletedObjectBM.Instance := Subject; Subject.AddRef; end; + FDeletedObjectBM.WasDisposed := ADispose; FUpdateStatus := usDeleted; end else Free; @@ -1713,11 +1722,10 @@ RecordBufferList.Add(ARecordBuffer); end; -constructor TInstantContentBuffer.Create(AAutoApplyChanges, ACanDispose: Boolean); +constructor TInstantContentBuffer.Create(AAutoApplyChanges: Boolean); begin inherited Create; FAutoApplyChanges := AAutoApplyChanges; - FCanDispose := ACanDispose; end; destructor TInstantContentBuffer.Destroy; @@ -1730,10 +1738,11 @@ var I: Integer; begin - if not AutoApplyChanges and CanDispose then + if not AutoApplyChanges then for I := 0 to Pred(RecordBufferCount) do - if RecordBuffer[I].UpdateStatus = usDeleted then - with RecordBuffer[I].FDeletedObjectBM.Instance do + if (RecordBuffer[I].UpdateStatus = usDeleted) and + RecordBuffer[I].DeletedObjectWasDisposed then + with RecordBuffer[I].DeletedObjectInstance do if CanDispose then Dispose; end; @@ -1791,14 +1800,14 @@ end; procedure TInstantContentBuffer.RegisterAsDeleted(AObject: TObject; - ARecNo: Integer); + ARecNo: Integer; ADispose: Boolean); begin - RegisterObjectUpdate(AObject, ARecno, usDeleted); + RegisterObjectUpdate(AObject, ARecno, ADispose, usDeleted); end; procedure TInstantContentBuffer.RegisterAsInserted(AObject: TObject); begin - RegisterObjectUpdate(AObject, 0, usInserted); + RegisterObjectUpdate(AObject, usInserted); end; procedure TInstantContentBuffer.RegisterAsModified(AObject: TObject; AState: TDataSetState); @@ -1809,11 +1818,11 @@ dsInsert: VUpdateStatus := usInserted; else {dsEdit} VUpdateStatus := usModified; end; - RegisterObjectUpdate(AObject, 0, VUpdateStatus); + RegisterObjectUpdate(AObject, VUpdateStatus); end; procedure TInstantContentBuffer.RegisterObjectUpdate(AObject: TObject; - ARecNo: Integer; AUpdateStatus: TUpdateStatus); + ARecNo: Integer; ADispose: Boolean; AUpdateStatus: TUpdateStatus); var VRecordBuffer: TInstantRecordBuffer; begin @@ -1829,12 +1838,18 @@ usInserted: VRecordBuffer.RegisterAsInserted; usDeleted: - VRecordBuffer.RegisterAsDeleted(ARecNo, AutoApplyChanges, CanDispose); + VRecordBuffer.RegisterAsDeleted(ARecNo, AutoApplyChanges, ADispose); else ; end; end; +procedure TInstantContentBuffer.RegisterObjectUpdate(AObject: TObject; + AUpdateStatus: TUpdateStatus); +begin + RegisterObjectUpdate(AObject, 0, False, AUpdateStatus); +end; + procedure TInstantContentBuffer.ReleaseRecordBuffer(ARecordBuffer: TInstantRecordBuffer); begin if Assigned(FRecordBufferList) then @@ -1871,13 +1886,13 @@ else AExposer.InternalInsertObject(DeletedObjectRecNo, DeletedObjectInstance); // Friend class - if AutoApplyChanges and CanDispose then + if AutoApplyChanges and DeletedObjectWasDisposed then begin if AExposer is TInstantSelector then // TInstantQuery - TheObject.Store is enough DeletedObjectInstance.Store else - // TInstantParts - need to call Subject.Store + // TInstantParts or TInstantRefereces - need to call Subject.Store SubjectChanged := True; end; end; @@ -2401,7 +2416,7 @@ constructor TInstantCustomExposer.Create(AOwner: TComponent); begin inherited Create(AOwner); - FOptions := [eoAutoApply, eoDisposeReferences]; + FOptions := [eoAutoApply, eoAutoRemember]; BookmarkSize := SizeOf(TInstantBookmark); FIsOpen := False; FFieldOptions := [foThorough]; @@ -2639,7 +2654,7 @@ function TInstantCustomExposer.GetCanDispose: Boolean; begin - if not (eoDisposeReferences in FOptions) and InContent and (Subject is TInstantObject) then + if (eoNotDisposeReferences in FOptions) and InContent and (Subject is TInstantObject) then Result := not (TInstantObject(Subject).FindContainer(ContainerName) is TInstantReferences) else Result := True; @@ -2653,7 +2668,7 @@ function TInstantCustomExposer.GetContentBuffer: TInstantContentBuffer; begin if not Assigned(FContentBuffer) then - FContentBuffer := TInstantContentBuffer.Create(AutoApplyChanges, CanDispose); + FContentBuffer := TInstantContentBuffer.Create(AutoApplyChanges); Result := FContentBuffer; end; @@ -3199,7 +3214,7 @@ if InContent then begin if FSaveRevertBuffer then - ContentBuffer.RegisterAsDeleted(AObject, FRecNo); + ContentBuffer.RegisterAsDeleted(AObject, FRecNo, CanDispose); FContentChanged := True; end; IsInstantObject := AObject is TInstantObject; @@ -3343,6 +3358,8 @@ procedure TInstantCustomExposer.InternalOpen; begin + if eoAutoRemember in Options then + Remember; FRecNo := 0; InternalInitFieldDefs; if DefaultFields then @@ -3811,6 +3828,15 @@ FSaveRevertBuffer := True; end; +procedure TInstantCustomExposer.Remove; +begin + if InContent and (Subject is TInstantObject) and + (TInstantObject(Subject).FindContainer(ContainerName) is TInstantReferences) then + RemoveObject(CurrentObject) + else + Delete; +end; + function TInstantCustomExposer.RemoveObject(AObject: TObject): Integer; begin if AObject is TInstantObject then @@ -3822,7 +3848,7 @@ if InContent then begin if FSaveRevertBuffer then - ContentBuffer.RegisterAsDeleted(AObject, Succ(Result)); + ContentBuffer.RegisterAsDeleted(AObject, Succ(Result), False); FContentChanged := True; end; Refresh; |
From: <jcm...@us...> - 2006-03-17 20:35:58
|
Revision: 653 Author: jcmoraisjr Date: 2006-03-17 12:35:48 -0800 (Fri, 17 Mar 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=653&view=rev Log Message: ----------- Changed TInstantRecordBuffer and TInstantContentBuffer to support all published properties, with or without an attribute, as well as other classes beyond TInstantObject. Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-03-16 21:44:48 UTC (rev 652) +++ trunk/Source/Core/InstantPresentation.pas 2006-03-17 20:35:48 UTC (rev 653) @@ -199,6 +199,7 @@ Field: TField; Attribute: TInstantAttribute; ClonedAttr: TInstantAttribute; + PropertyValue: Variant; end; TInstantContentBuffer = class; @@ -208,7 +209,7 @@ FDeletedObjectBM: TInstantDeletedObjectBookmark; FFieldBufferList: TList; FOwner: TInstantContentBuffer; - FSubject: TInstantObject; + FSubject: TObject; FUpdateStatus: TUpdateStatus; procedure FreeFieldBufferList; function GetDeletedObjectInstance: TInstantObject; @@ -235,7 +236,7 @@ property FieldBuffer[AIndex: Integer]: PInstantFieldBuffer read GetFieldBuffer; property FieldBufferCount: Integer read GetFieldBufferCount; property IsChanged: Boolean read GetIsChanged; - property Subject: TInstantObject read FSubject; + property Subject: TObject read FSubject; property UpdateStatus: TUpdateStatus read FUpdateStatus; end; @@ -1562,10 +1563,10 @@ constructor TInstantRecordBuffer.Create(AObject: TObject; AOwner: TInstantContentBuffer); begin inherited Create; - if AObject is TInstantObject then - FSubject := TInstantObject(AObject); + FSubject := AObject; FOwner := AOwner; FUpdateStatus := usUnmodified; + FDeletedObjectBM.Instance := nil; end; destructor TInstantRecordBuffer.Destroy; @@ -1651,14 +1652,15 @@ if UpdateStatus <> usInserted then begin FDeletedObjectBM.RecNo := ARecNo; - FDeletedObjectBM.Instance.Free; - if AAutoApplyChanges and ADispose then - FDeletedObjectBM.Instance := Subject.Clone - else - begin - FDeletedObjectBM.Instance := Subject; - Subject.AddRef; - end; + FreeAndNil(FDeletedObjectBM.Instance); + if Subject is TInstantObject then + if AAutoApplyChanges and ADispose then + FDeletedObjectBM.Instance := TInstantObject(Subject).Clone + else + begin + FDeletedObjectBM.Instance := TInstantObject(Subject); + FDeletedObjectBM.Instance.AddRef; + end; FDeletedObjectBM.WasDisposed := ADispose; FUpdateStatus := usDeleted; end else @@ -1681,20 +1683,39 @@ var VFieldBuffer: PInstantFieldBuffer; VAttr: TInstantAttribute; + VProperty: Variant; begin - if not Assigned(FSubject) or - not Assigned(AField) or (FindFieldIndex(AField) >= 0) then - Exit; - VAttr := InstantFindAttribute(AField.FieldName, FSubject); - if Assigned(VAttr) then + if Assigned(FSubject) and Assigned(AField) and (FindFieldIndex(AField) = -1) then begin + VAttr := nil; + try + if FSubject is TInstantObject then + VAttr := InstantFindAttribute(AField.FieldName, TInstantObject(FSubject)); + except + end; + if Assigned(VAttr) then + VarClear(VProperty) + else + VProperty := InstantGetProperty(FSubject, AField.FieldName); + New(VFieldBuffer); - VFieldBuffer.Field := AField; - VFieldBuffer.Attribute := VAttr; - VFieldBuffer.ClonedAttr := - TInstantAttributeClass(VAttr.ClassType).Create(nil, nil); - VFieldBuffer.ClonedAttr.Assign(VAttr); - FieldBufferList.Add(VFieldBuffer); + VFieldBuffer.ClonedAttr := nil; + try + VFieldBuffer.Field := AField; + VFieldBuffer.Attribute := VAttr; + if Assigned(VAttr) then + begin + VFieldBuffer.ClonedAttr := + TInstantAttributeClass(VAttr.ClassType).Create(nil, nil); + VFieldBuffer.ClonedAttr.Assign(VAttr); + end; + VFieldBuffer.PropertyValue := VProperty; + FieldBufferList.Add(VFieldBuffer); + except + FreeAndNil(VFieldBuffer.ClonedAttr); + Dispose(VFieldBuffer); + raise; + end; if UpdateStatus = usUnmodified then FUpdateStatus := usModified; end; @@ -1708,7 +1729,10 @@ begin for I := Pred(FieldBufferCount) downto 0 do with FieldBuffer[I]^ do - Attribute.Assign(ClonedAttr); + if Assigned(Attribute) then + Attribute.Assign(ClonedAttr) + else if not VarIsEmpty(PropertyValue) and not VarIsNull(PropertyValue) then + InstantSetProperty(FSubject, Field.FieldName, PropertyValue); FreeFieldBufferList; FUpdateStatus := usUnmodified; end; @@ -1740,11 +1764,12 @@ begin if not AutoApplyChanges then for I := 0 to Pred(RecordBufferCount) do - if (RecordBuffer[I].UpdateStatus = usDeleted) and - RecordBuffer[I].DeletedObjectWasDisposed then - with RecordBuffer[I].DeletedObjectInstance do - if CanDispose then - Dispose; + with RecordBuffer[I] do + if (UpdateStatus = usDeleted) and + Assigned(DeletedObjectInstance) and DeletedObjectWasDisposed then + with DeletedObjectInstance do + if CanDispose then + Dispose; end; function TInstantContentBuffer.FindRecordBuffer(AObject: TObject): TInstantRecordBuffer; @@ -1861,15 +1886,16 @@ procedure RevertModified(ARecordBuffer: TInstantRecordBuffer); begin ARecordBuffer.UndoChanges; - if AutoApplyChanges then - ARecordBuffer.Subject.Store; + if AutoApplyChanges and (ARecordBuffer.Subject is TInstantObject) then + TInstantObject(ARecordBuffer.Subject).Store; end; procedure RevertInserted(ARecordBuffer: TInstantRecordBuffer); begin - if AutoApplyChanges and (AExposer is TInstantSelector) then + if AutoApplyChanges and (ARecordBuffer.Subject is TInstantObject) and + (AExposer is TInstantSelector) then // Only Selectors can AutoStore new objects - ARecordBuffer.Subject.Dispose; + TInstantObject(ARecordBuffer.Subject).Dispose; AExposer.InternalRemoveObject(ARecordBuffer.Subject); // Friend class AExposer.Resync([]); end; @@ -1886,11 +1912,12 @@ else AExposer.InternalInsertObject(DeletedObjectRecNo, DeletedObjectInstance); // Friend class - if AutoApplyChanges and DeletedObjectWasDisposed then + if AutoApplyChanges and DeletedObjectWasDisposed and + (DeletedObjectInstance is TInstantObject) then begin if AExposer is TInstantSelector then // TInstantQuery - TheObject.Store is enough - DeletedObjectInstance.Store + TInstantObject(DeletedObjectInstance).Store else // TInstantParts or TInstantRefereces - need to call Subject.Store SubjectChanged := True; @@ -1913,8 +1940,8 @@ else ; end; - if SubjectChanged then - (AExposer.Subject as TInstantObject).Store; + if SubjectChanged and (AExposer.Subject is TInstantObject) then + TInstantObject(AExposer.Subject).Store; FreeRecordBufferList; end; |
From: <jcm...@us...> - 2006-03-17 20:51:33
|
Revision: 654 Author: jcmoraisjr Date: 2006-03-17 12:51:19 -0800 (Fri, 17 Mar 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=654&view=rev Log Message: ----------- Fixed a possible AV source into the last revision. Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-03-17 20:35:48 UTC (rev 653) +++ trunk/Source/Core/InstantPresentation.pas 2006-03-17 20:51:19 UTC (rev 654) @@ -1906,6 +1906,7 @@ procedure RevertDeleted(ARecordBuffer: TInstantRecordBuffer); begin with ARecordBuffer do + if Assigned(DeletedObjectInstance) then begin if DeletedObjectRecNo > AExposer.ObjectCount then AExposer.InternalAddObject(DeletedObjectInstance) // Friend class |
From: <jcm...@us...> - 2006-03-23 00:42:16
|
Revision: 655 Author: jcmoraisjr Date: 2006-03-22 16:42:05 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=655&view=rev Log Message: ----------- - Fixed bug # 1456595 - "RepositionObject method can include fields"; - Small improvements into revert buffer mechanism; - Fixed the patch to the bug # 1439091 - "Exposer.AddObject duplicating object (sorted lists)", that wasn't refreshing Query views. Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-03-17 20:51:19 UTC (rev 654) +++ trunk/Source/Core/InstantPresentation.pas 2006-03-23 00:42:05 UTC (rev 655) @@ -1460,8 +1460,9 @@ begin if Altered then begin - RemoveFromView(AObject); - Result := AddToView(AObject); + Result := RemoveFromView(AObject); + if Result >= 0 then + Result := AddToView(AObject); end else Result := -1; end; @@ -1765,11 +1766,9 @@ if not AutoApplyChanges then for I := 0 to Pred(RecordBufferCount) do with RecordBuffer[I] do - if (UpdateStatus = usDeleted) and - Assigned(DeletedObjectInstance) and DeletedObjectWasDisposed then - with DeletedObjectInstance do - if CanDispose then - Dispose; + if (UpdateStatus = usDeleted) and DeletedObjectWasDisposed and + DeletedObjectInstance.CanDispose then + DeletedObjectInstance.Dispose; end; function TInstantContentBuffer.FindRecordBuffer(AObject: TObject): TInstantRecordBuffer; @@ -1785,10 +1784,9 @@ function TInstantContentBuffer.FindRecordBufferIndex(AObject: TObject): Integer; begin - if AObject is TInstantObject then - for Result := 0 to Pred(RecordBufferCount) do - if RecordBuffer[Result].Subject = AObject then - Exit; + for Result := 0 to Pred(RecordBufferCount) do + if RecordBuffer[Result].Subject = AObject then + Exit; Result := -1; end; @@ -1888,6 +1886,7 @@ ARecordBuffer.UndoChanges; if AutoApplyChanges and (ARecordBuffer.Subject is TInstantObject) then TInstantObject(ARecordBuffer.Subject).Store; + AExposer.Accessor.RepositionObject(ARecordBuffer.Subject); // Friend class end; procedure RevertInserted(ARecordBuffer: TInstantRecordBuffer); @@ -1913,12 +1912,11 @@ else AExposer.InternalInsertObject(DeletedObjectRecNo, DeletedObjectInstance); // Friend class - if AutoApplyChanges and DeletedObjectWasDisposed and - (DeletedObjectInstance is TInstantObject) then + if AutoApplyChanges and DeletedObjectWasDisposed then begin if AExposer is TInstantSelector then // TInstantQuery - TheObject.Store is enough - TInstantObject(DeletedObjectInstance).Store + DeletedObjectInstance.Store else // TInstantParts or TInstantRefereces - need to call Subject.Store SubjectChanged := True; @@ -3912,16 +3910,15 @@ finally List.Free; end; + if State in [dsEdit, dsInsert] then + Cancel; if InContent and Assigned(FContentBuffer) then begin FContentBuffer.RevertChanges(Self); FreeAndNil(FContentBuffer); FContentChanged := False; end else if not InContent then - begin - Undo; RefreshDataView; - end; end; procedure TInstantCustomExposer.SaveField(Field: TField); @@ -4465,8 +4462,16 @@ function TInstantQueryAccessor.InternalAddObject( AObject: TObject): Integer; +var + Index: Integer; begin Result := Subject.AddObject(AObject); + if Altered then + begin + Index := AddToView(AObject); + if Index > -1 then + Result := Index; + end; end; procedure TInstantQueryAccessor.InternalApplyChanges; @@ -4504,6 +4509,8 @@ AObject: TObject): Integer; begin Subject.InsertObject(Index, AObject); + if Altered then + InsertInView(Index, AObject); Result := Index; end; @@ -4519,8 +4526,16 @@ function TInstantQueryAccessor.InternalRemoveObject( AObject: TObject): Integer; +var + Index: Integer; begin Result := Subject.RemoveObject(AObject); + if Altered then + begin + Index := RemoveFromView(AObject); + if Index > -1 then + Result := Index; + end; end; class function TInstantQueryAccessor.SubjectClass: TClass; |
From: <na...@us...> - 2006-05-18 18:18:48
|
Revision: 676 Author: nandod Date: 2006-05-18 11:18:40 -0700 (Thu, 18 May 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=676&view=rev Log Message: ----------- * added a virtual method to enable customization. Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-05-16 15:52:33 UTC (rev 675) +++ trunk/Source/Core/InstantPresentation.pas 2006-05-18 18:18:40 UTC (rev 676) @@ -461,6 +461,7 @@ procedure SetFiltered(Value: Boolean); override; procedure SetRecNo(Value: Integer); override; procedure Undo; virtual; + procedure UndoRecordBuffer(RecordBuffer: TInstantRecordBuffer); virtual; procedure UpdateCalcFields; procedure WriteProperty(Field: TField; Instance: TObject; Value: Variant); virtual; function BreakThorough( const FieldName : string ) : boolean; virtual; @@ -4197,11 +4198,16 @@ end; if Assigned(FRecordBuffer) then begin - FRecordBuffer.UndoChanges; + UndoRecordBuffer(FRecordBuffer); FreeAndNil(FRecordBuffer); end; end; +procedure TInstantCustomExposer.UndoRecordBuffer(RecordBuffer: TInstantRecordBuffer); +begin + RecordBuffer.UndoChanges; +end; + procedure TInstantCustomExposer.UpdateBookmark(var BM: TInstantBookmark); begin if (RecordCount = 0) or (BM.Instance = FRemovedObject) then |
From: <fas...@us...> - 2007-02-20 21:45:04
|
Revision: 758 http://svn.sourceforge.net/instantobjects/revision/?rev=758&view=rev Author: fastbike2 Date: 2007-02-20 13:44:49 -0800 (Tue, 20 Feb 2007) Log Message: ----------- [ 1651153] TInstantCustomExposer.Filter bugfix Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2007-02-01 04:27:01 UTC (rev 757) +++ trunk/Source/Core/InstantPresentation.pas 2007-02-20 21:44:49 UTC (rev 758) @@ -4077,14 +4077,20 @@ procedure TInstantCustomExposer.SetFiltered(Value: Boolean); begin - if Value <> Filtered then + if Active then begin - inherited; - if Filtered then - First - else - Refresh; - end; + CheckBrowseMode; + if Filtered <> Value then + begin + inherited SetFiltered(Value); + if Value then + First + else + Refresh; + end; + end + else + inherited SetFiltered(Value); end; procedure TInstantCustomExposer.SetLimited(Value: Boolean); |