ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/ibcontrols/DBControlGrid.pas
(Generate patch)

Comparing ibx/trunk/ibcontrols/DBControlGrid.pas (file contents):
Revision 34 by tony, Tue Jul 14 15:31:25 2015 UTC vs.
Revision 35 by tony, Tue Jan 26 14:38:47 2016 UTC

# Line 413 | Line 413 | end;
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;
# Line 540 | Line 541 | var
541   begin
542    OldFixedRows := FixedRows;
543    Clear;
544 +  FRowCache.ClearCache;
545    RowCount := OldFixedRows + 1;
546    if dgpIndicator in FOptions then
547      ColWidths[0]:=12;
# Line 620 | Line 622 | begin
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);
# Line 668 | Line 670 | begin
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
# Line 700 | Line 702 | end;
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;
# Line 1409 | Line 1421 | begin
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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines