Mega Code Archive

 
Categories / Delphi / Forms
 

Force a hint window to appear

Title: Force a hint window to appear Question: You might sometimes want to force a hint window to appear. For example, when the mouse enters a certain cell or column of a grid. Answer: Thanks to Jonas Juskys var hintWnd: THintWindow; procedure TForm1.ActivateHintNOW( x,y: Integer); var rect: TRect; begin HintTxt := 'qq'; if hintTxt '' then begin rect := hintWnd.CalcHintRect( Screen.Width, hinttxt, nil); rect.Left := rect.Left + x; rect.Right := rect.Right + x; rect.Top := rect.Top + y; rect.Bottom := rect.Bottom + y; hintWnd.ActivateHint( rect, hinttxt); end; end; Note: To hide a hint window that is activated directly by calling ActivateHint, use the ReleaseHandle method.