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

Comparing ibx/trunk/ibcontrols/DBControlGrid.pas (file contents):
Revision 35 by tony, Tue Jan 26 14:38:47 2016 UTC vs.
Revision 143 by tony, Fri Feb 23 12:11:21 2018 UTC

# Line 1 | Line 1
1 +  
2   {
3   /***************************************************************************
4                                 DBControlGrid.pas
# Line 285 | Line 286 | end;
286  
287   implementation
288  
289 < uses LCLType, Math, LCLIntf, Forms, LCLMessageGlue;
289 > uses LCLType, Math, LCLIntf, Forms, LCLMessageGlue, EditBtn, MaskEdit;
290  
291   { TDBControlGridDataLink }
292  
# Line 300 | Line 301 | end;
301  
302   function TRowCache.Render(Control: TWinControl): TBitmap;
303   var Container: TBitmap;
303     Msg: TLMPaint;
304   begin
305    Container := TBitmap.Create;
306    try
# Line 366 | Line 366 | begin
366      for i := StartIndex to Length(FList) - 1 do
367      begin
368        FList[i].FState := rcEmpty;
369 +      FList[i].FBitmap := nil;
370        FList[i].FAlternateColor := altColor;
371        if UseAlternateColors then
372          altColor := not altColor;
# Line 422 | Line 423 | begin
423    Dec(RecNo); {Adust to zero base}
424    ExtendCache(RecNo + 1);
425    FList[RecNo].FState := rcPresent;
426 +  if FList[RecNo].FBitmap <> nil then
427 +    FList[RecNo].FBitmap.Free;
428    FList[RecNo].FBitmap := Render(Control);
429    Result := FList[RecNo].FBitmap;
430   end;
# Line 478 | Line 481 | begin
481    if FList[RecNo].FState = rcPresent then
482    begin
483      FList[RecNo].FBitmap.Free;
484 +    FList[RecNo].FBitmap := nil;
485      FList[RecNo].FState := rcEmpty;
486    end;
487   end;
# Line 594 | Line 598 | begin
598      and ValidDataSet and FDatalink.DataSet.CanModify;
599   end;
600  
597
601   procedure TDBControlGrid.DoDrawRow(aRow: integer; aRect: TRect;
602    aState: TGridDrawState);
603   var CachedRow: TBitmap;
# Line 607 | Line 610 | begin
610      begin
611        FCacheRefreshQueued := true;
612        Application.QueueAsyncCall(@DoMoveRecord,PtrInt(aRow));
613 <    end
613 >    end;
614 >    Canvas.FillRect(aRect);
615    end
616    else
617       Canvas.Draw(aRect.Left,aRect.Top,CachedRow)
# Line 672 | Line 676 | begin
676      if (AControl <> nil) and (AControl is TCustomMemo)
677                           and (Key in [VK_RETURN,VK_UP,VK_DOWN]) then Exit; {Ignore Return in a CustomMemo}
678  
679 +    if (AControl <> nil) and (AControl is TCustomGrid)
680 +                         and (Key in [VK_RETURN,VK_UP,VK_DOWN,VK_TAB]) then Exit; {Ignore Return in a CustomMemo}
681 +
682 +    if (AControl <> nil) and ((AControl is TDateEdit) or (AControl is TCustomMaskedit))
683 +                         and (Key in [VK_RETURN,VK_UP,VK_DOWN,
684 +                               VK_ESCAPE,VK_LEFT,VK_RIGHT]) then Exit; {Ignore Return in a CustomMemo}
685      Done := false;
686      if assigned(FOnKeyDownHander) then
687        OnKeyDownHander(Sender,Key,Shift,Done);
# Line 693 | Line 703 | begin
703        and (FModified or (FRowCache.IsEmpty(aDataSet.RecNo))) then
704    begin
705      RecNo := aDataSet.RecNo;
696    Application.ProcessMessages;  {A couple of trips round the message loop seems to be necessary}
706      Application.ProcessMessages;
707      if RecNo = aDataSet.RecNo then   {Guard against sudden changes}
708 <      FRowCache.Add2Cache(aDataSet.RecNo,FDrawPanel);
708 >      FRowCache.Add2Cache(RecNo,FDrawPanel);
709    end;
710   end;
711  
# Line 855 | Line 864 | end;
864  
865   procedure TDBControlGrid.SetupDrawPanel(aRow: integer);
866   begin
867 +  if FDrawPanel = nil then Exit;
868    if ValidDataSet and FRowCache.AlternateColor[FDataLink.DataSet.RecNo] then
869      FDrawPanel.Color := AlternateColor
870    else
# Line 1174 | Line 1184 | begin
1184    if aCol < FixedCols then
1185       DrawIndicator(Canvas,aRow, aRect,GetDataSetState,false)
1186    else
1187 <  if FDrawPanel = nil then
1188 <    DrawFillRect(Canvas,aRect)    else
1187 >  if (FDrawPanel = nil) or not FDataLink.Active then
1188 >    DrawFillRect(Canvas,aRect)
1189 >  else
1190    if not FDrawingActiveRecord and FDataLink.Active then
1191        DoDrawRow(aRow,aRect,aState);
1192    {if we are drawing the active record then this is rendered by the Draw Panel
# Line 1680 | Line 1691 | begin
1691      FDataLink.Free;
1692    end;
1693    if assigned(FRowCache) then FRowCache.Free;
1694 +  Application.RemoveAsyncCalls(self);
1695    inherited Destroy;
1696   end;
1697  
# Line 1718 | Line 1730 | begin
1730   end;
1731  
1732   end.
1733 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines