You are not logged in.
when use TSynSQLTableDataSet with dbgrid, I found can not drag the scroll bar,
after debug, seem in TSynVirtualDataSet.SetRecNo add Resync([rmCenter]) can resolve the problem
procedure TSynVirtualDataSet.SetRecNo(Value: Integer);
begin
dec(Value);
if cardinal(Value)>=cardinal(GetRecordCount) then
raise ERangeError.CreateFmt('SetRecNo(%d) with Count=%d',[Value+1,GetRecordCount]);
DoBeforeScroll; //****add
fCurrentRow := Value;
Resync([rmCenter]); //****add
DoAfterScroll; //****add
end;
when use TSynSQLTableDataSet with cxgrid, then user can not move record,
after debug, seem in TSynVirtualDataSet.InternalOpen, need set the BookmarkSize length,
just like TClientDataSet,
procedure TCustomClientDataSet.InternalOpen;
...
BookmarkSize := CursorProps.iBookmarkSize;
because cxGrid use TDataSet.BookmarkAvailable, TDataSet.GetBookmark
to restore the cursor, this make TSynSQLTableDataSet can not move cursor,
and in SynVirtualDataSet, bookmark relative check nil, after Set BookmarkSize should never be nil
the change in http://synopse.info/fossil/info/8294ca8217 should not need.
procedure TSynVirtualDataSet.GetBookmarkData(Buffer: TRecordBuffer; Data: Pointer);
begin
if Data<>nil then //*** this should not be nil, if is nil then else should have some problem
PRecInfoIdentifier(Data)^ := PRecInfo(Buffer)^.Bookmark;
end;
BookmarkSize: http://docwiki.embarcadero.com/Librarie … okmarkSize
thanks!
Last edited by mingda (2013-11-20 07:58:07)
Offline
after test, such change seem fix the two problem:
procedure TSynVirtualDataSet.SetRecNo(Value: Integer);
begin
// dec(Value);
// if cardinal(Value)>=cardinal(GetRecordCount) then
// raise ERangeError.CreateFmt('SetRecNo(%d) with Count=%d',[Value+1,GetRecordCount]);
// fCurrentRow := Value;
CheckBrowseMode;
if Value <> RecNo then
begin
dec(Value);
if cardinal(Value)>=cardinal(GetRecordCount) then
raise ERangeError.CreateFmt('SetRecNo(%d) with Count=%d',[Value+1,GetRecordCount]);
DoBeforeScroll;
fCurrentRow := Value;
Resync([rmCenter]);
DoAfterScroll;
end;
end;
procedure TSynVirtualDataSet.InternalOpen;
begin
InternalInitFieldDefs;
if DefaultFields then
CreateFields;
BindFields(true);
fCurrentRow := -1;
fIsCursorOpen := True;
BookmarkSize := SizeOf(TRecInfo); //**** add
end;
Remove change at http://synopse.info/fossil/info/8294ca8217 also seems a bit fast
Update:
seems change to BookmarkSize := SizeOf(Integer) also work.
Test find a potential problem, when link a dbgrid and a cxgrid to a same datasource,
then drag dbgrid's scrollbar don't work.
thanks!
Last edited by mingda (2013-11-20 13:14:48)
Offline
Please take a look at this commit:
http://synopse.info/fossil/info/8d0c2db1d4
I suppose it includes all your proposals.
Thanks!
Offline