97 |
|
procedure ClearCache; |
98 |
|
function Add2Cache(RecNo: Longint; Control: TWinControl): TBitmap; |
99 |
|
function GetRowImage(RecNo, Offset: integer): TBitmap; |
100 |
+ |
procedure InvalidateRowImage(RecNo: integer); |
101 |
|
function IsEmpty(RecNo: integer): boolean; |
102 |
|
procedure MarkAsDeleted(RecNo: integer); |
103 |
|
property AlternateColor[RecNo: integer]: boolean read GetAlternateColor; |
159 |
|
function GridCanModify: boolean; |
160 |
|
procedure DoDrawRow(aRow: integer; aRect: TRect; aState: TGridDrawState); |
161 |
|
procedure DoMoveRecord(Data: PtrInt); |
162 |
+ |
procedure DoSelectNext(Data: PtrInt); |
163 |
|
procedure DoScrollDataSet(Data: PtrInt); |
164 |
|
procedure DoSetupDrawPanel(Data: PtrInt); |
165 |
|
procedure DoSendMouseClicks(Data: PtrInt); |
237 |
|
property Color; |
238 |
|
property Constraints; |
239 |
|
property DataSource: TDataSource read GetDataSource write SetDataSource; |
238 |
– |
property DefaultRowHeight; |
240 |
|
property DefaultPositionAtEnd: boolean read FDefaultPositionAtEnd write FDefaultPositionAtEnd; |
241 |
|
property DragCursor; |
242 |
|
property DragMode; |
467 |
|
until false; |
468 |
|
end; |
469 |
|
|
470 |
+ |
procedure TRowCache.InvalidateRowImage(RecNo: integer); |
471 |
+ |
begin |
472 |
+ |
Dec(RecNo); {adjust to zero base} |
473 |
+ |
if (RecNo < 0) or (RecNo >= Length(FList)) then |
474 |
+ |
Exit; |
475 |
+ |
|
476 |
+ |
if FList[RecNo].FState = rcPresent then |
477 |
+ |
begin |
478 |
+ |
FList[RecNo].FBitmap.Free; |
479 |
+ |
FList[RecNo].FState := rcEmpty; |
480 |
+ |
end; |
481 |
+ |
end; |
482 |
+ |
|
483 |
|
function TRowCache.IsEmpty(RecNo: integer): boolean; |
484 |
|
begin |
485 |
|
Dec(RecNo); |
686 |
|
end; |
687 |
|
FLastRecordCount := GetRecordCount; |
688 |
|
if aDataSet.State = dsInsert then |
689 |
+ |
begin |
690 |
|
FRequiredRecNo := aDataSet.RecNo + 1; |
691 |
+ |
Application.QueueAsyncCall(@DoSelectNext,0); |
692 |
+ |
end; |
693 |
|
UpdateActive |
694 |
|
end; |
695 |
|
|
778 |
|
RemoveFreeNotification(FDrawPanel); |
779 |
|
FDrawPanel.RemoveAllHandlersOfObject(self); |
780 |
|
theForm := Parent; |
781 |
< |
while not (theForm is TCustomForm) and (theForm.Parent <> nil) do |
781 |
> |
while not ((theForm is TCustomForm) or (theForm is TCustomFrame)) |
782 |
> |
and (theForm.Parent <> nil) do |
783 |
|
theForm := theForm.Parent; |
784 |
|
FDrawPanel.Parent := theForm; |
785 |
|
end; |
796 |
|
FDrawPanel.Visible := false; |
797 |
|
FRowCache.Height := FDrawPanel.Height; |
798 |
|
FRowCache.Width := FDrawPanel.Width; |
799 |
< |
AddHandlerOnResize(@OnDrawPanelResize); |
799 |
> |
FDrawPanel.AddHandlerOnResize(@OnDrawPanelResize); |
800 |
|
FreeNotification(FDrawPanel); |
801 |
|
end; |
802 |
|
except |
1084 |
|
FDataLink.DataSet.MoveBy(integer(Data) - FDataLink.DataSet.RecNo); |
1085 |
|
end; |
1086 |
|
|
1087 |
+ |
procedure TDBControlGrid.DoSelectNext(Data: PtrInt); |
1088 |
+ |
begin |
1089 |
+ |
FDataLink.DataSet.MoveBy(1); |
1090 |
+ |
end; |
1091 |
+ |
|
1092 |
|
procedure TDBControlGrid.DrawAllRows; |
1093 |
|
begin |
1094 |
|
inherited DrawAllRows; |
1139 |
|
if aCol < FixedCols then |
1140 |
|
DrawIndicator(Canvas,aRow, aRect,GetDataSetState,false) |
1141 |
|
else |
1142 |
+ |
if FDrawPanel = nil then |
1143 |
+ |
DrawFillRect(Canvas,aRect) else |
1144 |
|
if not FDrawingActiveRecord and FDataLink.Active then |
1145 |
|
DoDrawRow(aRow,aRect,aState); |
1146 |
|
{if we are drawing the active record then this is rendered by the Draw Panel |
1575 |
|
PrevRow := Row; |
1576 |
|
Row := FDrawRow; |
1577 |
|
if not FInCacheRefresh then |
1578 |
+ |
begin |
1579 |
|
FSelectedRow := FDrawRow; |
1580 |
+ |
if FDatalink.DataSet.State <> dsInsert then |
1581 |
+ |
FRowCache.InvalidateRowImage(FSelectedRecNo); |
1582 |
+ |
end; |
1583 |
|
InvalidateRow(PrevRow); |
1584 |
|
SetupDrawPanel(FDrawRow); |
1585 |
|
end; |