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 35 by tony, Tue Jan 26 14:38:47 2016 UTC vs.
Revision 45 by tony, Tue Dec 6 10:33:46 2016 UTC

# Line 285 | Line 285 | end;
285  
286   implementation
287  
288 < uses LCLType, Math, LCLIntf, Forms, LCLMessageGlue;
288 > uses LCLType, Math, LCLIntf, Forms, LCLMessageGlue, EditBtn, MaskEdit;
289  
290   { TDBControlGridDataLink }
291  
# Line 300 | Line 300 | end;
300  
301   function TRowCache.Render(Control: TWinControl): TBitmap;
302   var Container: TBitmap;
303     Msg: TLMPaint;
303   begin
304    Container := TBitmap.Create;
305    try
# Line 366 | Line 365 | begin
365      for i := StartIndex to Length(FList) - 1 do
366      begin
367        FList[i].FState := rcEmpty;
368 +      FList[i].FBitmap := nil;
369        FList[i].FAlternateColor := altColor;
370        if UseAlternateColors then
371          altColor := not altColor;
# Line 422 | Line 422 | begin
422    Dec(RecNo); {Adust to zero base}
423    ExtendCache(RecNo + 1);
424    FList[RecNo].FState := rcPresent;
425 +  if FList[RecNo].FBitmap <> nil then
426 +    FList[RecNo].FBitmap.Free;
427    FList[RecNo].FBitmap := Render(Control);
428    Result := FList[RecNo].FBitmap;
429   end;
# Line 478 | Line 480 | begin
480    if FList[RecNo].FState = rcPresent then
481    begin
482      FList[RecNo].FBitmap.Free;
483 +    FList[RecNo].FBitmap := nil;
484      FList[RecNo].FState := rcEmpty;
485    end;
486   end;
# Line 594 | Line 597 | begin
597      and ValidDataSet and FDatalink.DataSet.CanModify;
598   end;
599  
597
600   procedure TDBControlGrid.DoDrawRow(aRow: integer; aRect: TRect;
601    aState: TGridDrawState);
602   var CachedRow: TBitmap;
# Line 672 | Line 674 | begin
674      if (AControl <> nil) and (AControl is TCustomMemo)
675                           and (Key in [VK_RETURN,VK_UP,VK_DOWN]) then Exit; {Ignore Return in a CustomMemo}
676  
677 +    if (AControl <> nil) and (AControl is TCustomGrid)
678 +                         and (Key in [VK_RETURN,VK_UP,VK_DOWN,VK_TAB]) then Exit; {Ignore Return in a CustomMemo}
679 +
680 +    if (AControl <> nil) and ((AControl is TDateEdit) or (AControl is TCustomMaskedit))
681 +                         and (Key in [VK_RETURN,VK_UP,VK_DOWN,
682 +                               VK_ESCAPE,VK_LEFT,VK_RIGHT]) then Exit; {Ignore Return in a CustomMemo}
683      Done := false;
684      if assigned(FOnKeyDownHander) then
685        OnKeyDownHander(Sender,Key,Shift,Done);
# Line 693 | Line 701 | begin
701        and (FModified or (FRowCache.IsEmpty(aDataSet.RecNo))) then
702    begin
703      RecNo := aDataSet.RecNo;
696    Application.ProcessMessages;  {A couple of trips round the message loop seems to be necessary}
704      Application.ProcessMessages;
705      if RecNo = aDataSet.RecNo then   {Guard against sudden changes}
706 <      FRowCache.Add2Cache(aDataSet.RecNo,FDrawPanel);
706 >      FRowCache.Add2Cache(RecNo,FDrawPanel);
707    end;
708   end;
709  
# Line 855 | Line 862 | end;
862  
863   procedure TDBControlGrid.SetupDrawPanel(aRow: integer);
864   begin
865 +  if FDrawPanel = nil then Exit;
866    if ValidDataSet and FRowCache.AlternateColor[FDataLink.DataSet.RecNo] then
867      FDrawPanel.Color := AlternateColor
868    else
# Line 1174 | Line 1182 | begin
1182    if aCol < FixedCols then
1183       DrawIndicator(Canvas,aRow, aRect,GetDataSetState,false)
1184    else
1185 <  if FDrawPanel = nil then
1186 <    DrawFillRect(Canvas,aRect)    else
1185 >  if (FDrawPanel = nil) or not FDataLink.Active then
1186 >    DrawFillRect(Canvas,aRect)
1187 >  else
1188    if not FDrawingActiveRecord and FDataLink.Active then
1189        DoDrawRow(aRow,aRect,aState);
1190    {if we are drawing the active record then this is rendered by the Draw Panel
# Line 1718 | Line 1727 | begin
1727   end;
1728  
1729   end.
1730 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines