Cell level hints are designed to be immediate on the mouse move. I will log your request for a delayed cell hint. Only the component hint is delayed.
If you really need this, you can customize the application’s hint property via the grid’s OnMouseMove. Then it will respect your application’s hint timer, etc. Here is an example. Note to set your ShowHint to true for the grid and disable dgCellHints for this to work.
Put the following in your form’s implementation section.
type TwwHintGrid = class(TwwDBGrid);
var
lastx :integer = 0;
lasty : integer = 0;
Then put the following code in your grid’s OnMouseMove.
procedure TBtnGridForm.wwDBGrid1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
var
PriorRow: Integer;
indicatoroffset, titleoffset: Integer;
coord: TGridCoord;
begin
coord:= TwwDBGrid(Sender).MouseCoord(X, Y);
begin
if ((coord.X <> lastx) or (coord.Y <> lasty)) then
begin
application.cancelhint;
indicatoroffset := 0;
titleoffset := 0;
if TwwDBGridOption.dgIndicator in TwwDBGrid(Sender).Options then
indicatoroffset := 1;
if TwwDBGridOption.dgTitles in TwwDBGrid(Sender).Options then
titleoffset := 1;
if (coord.Y >= titleoffset) and (coord.X >= indicatoroffset) then // data cell
begin
PriorRow := TwwDBGrid(Sender).GetActiveRow;
TwwHintGrid(Sender).DataLink.ActiveRecord := coord.Y - titleoffset;
if coord.X - indicatoroffset < TwwDBGrid(Sender).GetColCount then
TwwHintGrid(Sender).Hint := TwwDBGrid(Sender).Fields[coord.X - indicatoroffset].asString;
TwwHintGrid(Sender).DataLink.ActiveRecord := PriorRow;
end
else if (coord.Y < titleoffset) and (coord.X>= indicatorOffset) then // Hint for titles
begin
TwwHintGrid(Sender).Hint := TwwDBGrid(Sender).Fields[coord.X-IndicatorOffset].DisplayLabel
end
else if (coord.x < indicatorOffset) and (coord.Y <TitleOffset) then // indicator column do clear hint
begin
// Does not work if you attached an indicator button
// In that case, just attach your hint to the indicator button's hint/showhint properties
TwwHintGrid(Sender).Hint := 'Top Left Hint'
end
else begin // default to blank if none of the above
TwwHintGrid(Sender).Hint := ''
end;
lastx := coord.X;
lasty := coord.Y;
end;
end
end;
Roy Woll