285 |
|
|
286 |
|
implementation |
287 |
|
|
288 |
< |
uses LCLType, Math, LCLIntf, Forms, LCLMessageGlue; |
288 |
> |
uses LCLType, Math, LCLIntf, Forms, LCLMessageGlue, EditBtn, MaskEdit; |
289 |
|
|
290 |
|
{ TDBControlGridDataLink } |
291 |
|
|
300 |
|
|
301 |
|
function TRowCache.Render(Control: TWinControl): TBitmap; |
302 |
|
var Container: TBitmap; |
303 |
– |
Msg: TLMPaint; |
303 |
|
begin |
304 |
|
Container := TBitmap.Create; |
305 |
|
try |
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; |
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; |
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; |
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; |
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); |
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 |
|
|
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 |
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 |
1689 |
|
FDataLink.Free; |
1690 |
|
end; |
1691 |
|
if assigned(FRowCache) then FRowCache.Free; |
1692 |
+ |
Application.RemoveAsyncCalls(self); |
1693 |
|
inherited Destroy; |
1694 |
|
end; |
1695 |
|
|
1728 |
|
end; |
1729 |
|
|
1730 |
|
end. |
1731 |
+ |
|