DBGrids: Improved cell hints.

git-svn-id: trunk@55207 -
This commit is contained in:
wp 2017-06-04 10:18:34 +00:00
parent b29915c159
commit 11f3b76108
2 changed files with 12 additions and 2 deletions

View File

@ -1517,8 +1517,9 @@ begin
Result := '';
if (ARow < FixedRows) then
exit;
C := ColumnFromGridColumn(ACol) as TColumn;
Result := C.Field.AsString;
if Assigned(FOnGetCellHint) then begin
C := ColumnFromGridColumn(ACol) as TColumn;
FOnGetCellHint(self, C, Result);
end;
@ -1527,16 +1528,24 @@ end;
function TCustomDBGrid.GetTruncCellHintText(aCol, aRow: Integer): string;
var
F: TField;
C: TColumn;
begin
Result := '';
if ARow < FixedRows then
exit;
F := GetFieldFromGridColumn(ACol);
if (F <> nil) then
if (F.DataType = ftMemo) then
Result := F.AsString
else
if (F.DataType <> ftBlob) then
Result := F.DisplayText
else
Result := '(blob)';
if Assigned(FOnGetCellHint) then begin
C := ColumnFromGridColumn(ACol) as TColumn;
FOnGetCellHint(self, C, Result);
end;
end;
// obtain the field either from a Db column or directly from dataset fields

View File

@ -7813,7 +7813,8 @@ end;
procedure TCustomGrid.CMMouseEnter(var Message: TLMessage);
begin
inherited;
FSavedHint := Hint;
if FCellHintPriority = chpAll then
FSavedHint := Hint;
end;
procedure TCustomGrid.CMMouseLeave(var Message: TLMessage);