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

View File

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