Page 1 of 1
TZAbstractDataset.InternalPost and BUG-FIX by bangfauzan
Posted: 20.01.2010, 14:19
by hemmingway
The BUG-FIX by bangfauzan sets unused bookmarks.
This causes the events BeforeScroll and AfterScroll.
In fact the dataset is the same as before.
The events BeforeScroll and AfterScroll produce many problems in my application.
Is this BUG-FIX a bug?
Is this better?
Replace
- BookMark:=BM;
with
- If BookmarkValid(@BM) Then Begin
- InternalGotoBookmark(@BM);
- Resync([rmExact, rmCenter]);
- End;
Posted: 25.01.2010, 23:20
by mdaems
Don't knowx if that's better. Did you test it?
Mark
Posted: 27.01.2010, 10:15
by hemmingway
I don't work with bookmarks. My changes avoid external events (OnBeforeScroll, OnAfterScroll), but the internal action is the same.
The bangfauzan bugfix is only meaningful if a valid bookmark exists.
My large application did not work with this bugfix.
With my changes up to now no errors occurred.
Greetings, Bernhard
Posted: 29.01.2010, 22:21
by mdaems
Your changes seem quite logical.
I commit them in SVN Rev 781. If they don't raise issues for other users before the next release they'll be included in next stable release too.
Mark
Posted: 19.02.2010, 12:06
by hemmingway
For checkin the complete code:
{BUG-FIX: bangfauzan addition}
if (SortedFields <> '') and not (doDontSortOnPost in Options) then
begin
FreeFieldBuffers;
SetState(dsBrowse);
Resync([]);
BM:=Bookmark;
DisableControls;
InternalSort;
//BookMark:=BM;
Try
If BookmarkValid(@BM) Then Begin
InternalGotoBookmark(@BM);
Resync([rmExact, rmCenter]);
End;
Finally
UpdateCursorPos;
EnableControls;
End;
end;
{end of bangfauzan addition}
Greetings, Bernhard
Posted: 21.02.2010, 13:12
by bangfauzan
thanks for your contribution, probably it's better.
Posted: 08.03.2010, 12:00
by hemmingway
I test the changes in Delphi 2010.
The first resync([]) sets the Bookmark to undefined values.
So I moved the check for a valid Bookmark to an earlier Position:
{ BUG-FIX: bangfauzan addition }
if (SortedFields <> '') and not(doDontSortOnPost in Options) then begin
If BookmarkValid(Bookmark) Then Begin
FreeFieldBuffers;
SetState(dsBrowse);
Resync([]);
BM := Bookmark;
DisableControls;
InternalSort;
// BookMark:=BM;
Try
InternalGotoBookmark(@BM);
Resync([rmExact, rmCenter]);
Finally
UpdateCursorPos;
EnableControls;
End;
End;
end;
{ end of bangfauzan addition }
Posted: 08.03.2010, 12:13
by hemmingway
I test the changes in Delphi 2010.
The first resync([]) sets the Bookmark to undefined values.
So I moved the check for a valid Bookmark to an earlier Position:
{ BUG-FIX: bangfauzan addition }
if (SortedFields <> '') and not(doDontSortOnPost in Options) then begin
If BookmarkValid(Bookmark) Then Begin
FreeFieldBuffers;
SetState(dsBrowse);
Resync([]);
BM := Bookmark;
DisableControls;
InternalSort;
// BookMark:=BM;
Try
InternalGotoBookmark(@BM);
Resync([rmExact, rmCenter]);
Finally
UpdateCursorPos;
EnableControls;
End;
End;
end;
{ end of bangfauzan addition }
Posted: 18.03.2010, 22:30
by mdaems
Doesn't compile in D7
Error: Incompatible types: 'String' and 'Pointer'
On 'If Bookmarkvalid' line.
Do you know how to fix that?
Mark
Posted: 27.03.2010, 10:29
by hemmingway
In REV 800 BM is totally undefined
This code sniplet compiles on Delphi 7 and 2010:
{ BUG-FIX: bangfauzan addition }
if (SortedFields <> '') and not(doDontSortOnPost in Options) then begin
{$IFDEF DELPHI12_UP}
If BookmarkValid(Bookmark) Then
{$ELSE}
If BookmarkValid(PPointer(Bookmark)) Then
{$ENDIF}
Begin
FreeFieldBuffers;
SetState(dsBrowse);
Resync([]);
BM := Bookmark;
DisableControls;
InternalSort;
//BookMark := BM;
Try
InternalGotoBookmark(PPointer(BM));
Resync([rmExact, rmCenter]);
Finally
UpdateCursorPos;
EnableControls;
End;
End;
end;
{ end of bangfauzan addition }
Greetings, Bernhard