TZAbstractDataset.InternalPost and BUG-FIX by bangfauzan

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
hemmingway
Fresh Boarder
Fresh Boarder
Posts: 21
Joined: 20.01.2010, 13:51

TZAbstractDataset.InternalPost and BUG-FIX by bangfauzan

Post 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? :x

Is this better?

Replace
- BookMark:=BM;
with
- If BookmarkValid(@BM) Then Begin
- InternalGotoBookmark(@BM);
- Resync([rmExact, rmCenter]);
- End;
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Don't knowx if that's better. Did you test it?

Mark
Image
hemmingway
Fresh Boarder
Fresh Boarder
Posts: 21
Joined: 20.01.2010, 13:51

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
hemmingway
Fresh Boarder
Fresh Boarder
Posts: 21
Joined: 20.01.2010, 13:51

Post 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
bangfauzan
Senior Boarder
Senior Boarder
Posts: 50
Joined: 31.08.2006, 10:41
Contact:

Post by bangfauzan »

thanks for your contribution, probably it's better.
hemmingway
Fresh Boarder
Fresh Boarder
Posts: 21
Joined: 20.01.2010, 13:51

Post by hemmingway »

I test the changes in Delphi 2010.
The first resync([]) sets the Bookmark to undefined values. :shock:
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 }
hemmingway
Fresh Boarder
Fresh Boarder
Posts: 21
Joined: 20.01.2010, 13:51

Post by hemmingway »

I test the changes in Delphi 2010.
The first resync([]) sets the Bookmark to undefined values. :shock:
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 }
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
hemmingway
Fresh Boarder
Fresh Boarder
Posts: 21
Joined: 20.01.2010, 13:51

Post 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
Post Reply