413 |
|
procedure TRowCache.ClearCache; |
414 |
|
begin |
415 |
|
FreeImages(true); |
416 |
+ |
SetLength(FList,0); |
417 |
|
end; |
418 |
|
|
419 |
|
function TRowCache.Add2Cache(RecNo: Longint; Control: TWinControl): TBitmap; |
541 |
|
begin |
542 |
|
OldFixedRows := FixedRows; |
543 |
|
Clear; |
544 |
+ |
FRowCache.ClearCache; |
545 |
|
RowCount := OldFixedRows + 1; |
546 |
|
if dgpIndicator in FOptions then |
547 |
|
ColWidths[0]:=12; |
622 |
|
aRow := integer(Data); |
623 |
|
FInCacheRefresh := true; |
624 |
|
if assigned(FDataLink.DataSet) then |
625 |
< |
FDatalink.DataSet.MoveBy(aRow - FDrawRow) |
625 |
> |
FDatalink.DataSet.MoveBy(aRow - FDrawRow); |
626 |
|
end; |
627 |
|
|
628 |
|
procedure TDBControlGrid.DoSetupDrawPanel(Data: PtrInt); |
670 |
|
Exit; {ignore these keys if we are in a combobox} |
671 |
|
|
672 |
|
if (AControl <> nil) and (AControl is TCustomMemo) |
673 |
< |
and (Key = VK_RETURN) then Exit; {Ignore Return in a CustomMemo} |
673 |
> |
and (Key in [VK_RETURN,VK_UP,VK_DOWN]) then Exit; {Ignore Return in a CustomMemo} |
674 |
|
|
675 |
|
Done := false; |
676 |
|
if assigned(FOnKeyDownHander) then |
702 |
|
|
703 |
|
procedure TDBControlGrid.OnDataSetChanged(aDataSet: TDataSet); |
704 |
|
begin |
705 |
< |
if (aDataSet.State = dsBrowse) and (FLastRecordCount > GetRecordCount) then |
705 |
> |
if aDataSet.State = dsBrowse then |
706 |
|
begin |
707 |
< |
{must be delete} |
708 |
< |
FRowCache.MarkAsDeleted(FSelectedRecNo); |
709 |
< |
Dec(FSelectedRow); |
707 |
> |
if GetRecordCount = 0 then |
708 |
> |
begin |
709 |
> |
{Must be closed/reopened} |
710 |
> |
FRowCache.ClearCache; |
711 |
> |
FSelectedRow := 0; |
712 |
> |
end |
713 |
> |
else |
714 |
> |
if FLastRecordCount > GetRecordCount then |
715 |
> |
begin |
716 |
> |
{must be delete} |
717 |
> |
FRowCache.MarkAsDeleted(FSelectedRecNo); |
718 |
> |
Dec(FSelectedRow); |
719 |
> |
end; |
720 |
|
LayoutChanged; |
721 |
|
end; |
722 |
|
FLastRecordCount := GetRecordCount; |
1421 |
|
FInCacheRefresh := false; |
1422 |
|
FCacheRefreshQueued := false; |
1423 |
|
Row := FixedRows; |
1424 |
+ |
FDrawingActiveRecord := false; |
1425 |
+ |
FSelectedRecNo := 0; |
1426 |
+ |
FSelectedRow := 0; |
1427 |
+ |
FRequiredRecNo := 0; |
1428 |
|
end; |
1429 |
|
FRowCache.UseAlternateColors := AlternateColor <> Color; |
1430 |
|
FRowCache.AltColorStartNormal := AltColorStartNormal; |