97 |
|
procedure ClearCache; |
98 |
|
function Add2Cache(RecNo: Longint; Control: TWinControl): TBitmap; |
99 |
|
function GetRowImage(RecNo, Offset: integer): TBitmap; |
100 |
+ |
procedure InvalidateRowImage(RecNo: integer); |
101 |
|
function IsEmpty(RecNo: integer): boolean; |
102 |
|
procedure MarkAsDeleted(RecNo: integer); |
103 |
|
property AlternateColor[RecNo: integer]: boolean read GetAlternateColor; |
152 |
|
FLastMouseButton: TMouseButton; |
153 |
|
FLastMouseShiftState: TShiftState; |
154 |
|
|
155 |
+ |
function ActiveControl: TControl; |
156 |
|
procedure EmptyGrid; |
157 |
|
function GetDataSource: TDataSource; |
158 |
|
function GetRecordCount: Integer; |
238 |
|
property Color; |
239 |
|
property Constraints; |
240 |
|
property DataSource: TDataSource read GetDataSource write SetDataSource; |
239 |
– |
property DefaultRowHeight; |
241 |
|
property DefaultPositionAtEnd: boolean read FDefaultPositionAtEnd write FDefaultPositionAtEnd; |
242 |
|
property DragCursor; |
243 |
|
property DragMode; |
468 |
|
until false; |
469 |
|
end; |
470 |
|
|
471 |
+ |
procedure TRowCache.InvalidateRowImage(RecNo: integer); |
472 |
+ |
begin |
473 |
+ |
Dec(RecNo); {adjust to zero base} |
474 |
+ |
if (RecNo < 0) or (RecNo >= Length(FList)) then |
475 |
+ |
Exit; |
476 |
+ |
|
477 |
+ |
if FList[RecNo].FState = rcPresent then |
478 |
+ |
begin |
479 |
+ |
FList[RecNo].FBitmap.Free; |
480 |
+ |
FList[RecNo].FState := rcEmpty; |
481 |
+ |
end; |
482 |
+ |
end; |
483 |
+ |
|
484 |
|
function TRowCache.IsEmpty(RecNo: integer): boolean; |
485 |
|
begin |
486 |
|
Dec(RecNo); |
523 |
|
|
524 |
|
{ TDBControlGrid } |
525 |
|
|
526 |
+ |
function TDBControlGrid.ActiveControl: TControl; |
527 |
+ |
var AParent: TWinControl; |
528 |
+ |
begin |
529 |
+ |
Result := nil; |
530 |
+ |
AParent := Parent; |
531 |
+ |
while (AParent <> nil) and not (AParent is TCustomForm) do |
532 |
+ |
AParent := AParent.Parent; |
533 |
+ |
if (AParent <> nil) and (AParent is TCustomForm)then |
534 |
+ |
Result := TCustomForm(AParent).ActiveControl; |
535 |
+ |
end; |
536 |
+ |
|
537 |
|
procedure TDBControlGrid.EmptyGrid; |
538 |
|
var |
539 |
|
OldFixedRows: Integer; |
656 |
|
procedure TDBControlGrid.KeyDownHandler(Sender: TObject; var Key: Word; |
657 |
|
Shift: TShiftState); |
658 |
|
var Done: boolean; |
659 |
+ |
AControl: TControl; |
660 |
|
begin |
661 |
|
if Visible and assigned(FDrawPanel) and FDrawPanel.Visible and FWeHaveFocus then |
662 |
|
begin |
663 |
+ |
AControl := ActiveControl; |
664 |
+ |
if (AControl <> nil) and (AControl is TCustomComboBox) |
665 |
+ |
and ((Key in [VK_UP,VK_DOWN]) or |
666 |
+ |
(TCustomComboBox(AControl).DroppedDown and (Key = VK_RETURN)) or |
667 |
+ |
((TCustomComboBox(AControl).Text <> '') and (Key = VK_ESCAPE))) then |
668 |
+ |
Exit; {ignore these keys if we are in a combobox} |
669 |
+ |
|
670 |
+ |
if (AControl <> nil) and (AControl is TCustomMemo) |
671 |
+ |
and (Key = VK_RETURN) then Exit; {Ignore Return in a CustomMemo} |
672 |
+ |
|
673 |
|
Done := false; |
674 |
|
if assigned(FOnKeyDownHander) then |
675 |
|
OnKeyDownHander(Sender,Key,Shift,Done); |
801 |
|
RemoveFreeNotification(FDrawPanel); |
802 |
|
FDrawPanel.RemoveAllHandlersOfObject(self); |
803 |
|
theForm := Parent; |
804 |
< |
while not (theForm is TCustomForm) and (theForm.Parent <> nil) do |
804 |
> |
while not ((theForm is TCustomForm) or (theForm is TCustomFrame)) |
805 |
> |
and (theForm.Parent <> nil) do |
806 |
|
theForm := theForm.Parent; |
807 |
|
FDrawPanel.Parent := theForm; |
808 |
|
end; |
819 |
|
FDrawPanel.Visible := false; |
820 |
|
FRowCache.Height := FDrawPanel.Height; |
821 |
|
FRowCache.Width := FDrawPanel.Width; |
822 |
< |
AddHandlerOnResize(@OnDrawPanelResize); |
822 |
> |
FDrawPanel.AddHandlerOnResize(@OnDrawPanelResize); |
823 |
|
FreeNotification(FDrawPanel); |
824 |
|
end; |
825 |
|
except |
1162 |
|
if aCol < FixedCols then |
1163 |
|
DrawIndicator(Canvas,aRow, aRect,GetDataSetState,false) |
1164 |
|
else |
1165 |
+ |
if FDrawPanel = nil then |
1166 |
+ |
DrawFillRect(Canvas,aRect) else |
1167 |
|
if not FDrawingActiveRecord and FDataLink.Active then |
1168 |
|
DoDrawRow(aRow,aRect,aState); |
1169 |
|
{if we are drawing the active record then this is rendered by the Draw Panel |
1598 |
|
PrevRow := Row; |
1599 |
|
Row := FDrawRow; |
1600 |
|
if not FInCacheRefresh then |
1601 |
+ |
begin |
1602 |
|
FSelectedRow := FDrawRow; |
1603 |
+ |
if FDatalink.DataSet.State <> dsInsert then |
1604 |
+ |
FRowCache.InvalidateRowImage(FSelectedRecNo); |
1605 |
+ |
end; |
1606 |
|
InvalidateRow(PrevRow); |
1607 |
|
SetupDrawPanel(FDrawRow); |
1608 |
|
end; |