2007. október 28., vasárnap

Change the hint display delay


Problem/Question/Abstract:

How to change the hint display delay

Answer:

Solve 1:

I usually use a procedure like this, so it�ll calculate the needed time to display any hint:

procedure TDM.DoShowHint(var HintStr: string; var CanShow: Boolean; var HintInfo:
  THintInfo);
begin
  CanShow := not ExibirHints;
    {Global variable the user configured to display the hint or not}
  HintInfo.HideTimeout := Length(HintStr) * 50;
    {Calculate the size of the string to wait a certain time}
end;


Solve 2:

Put a TApplicationEvents component and play with the OnShowHint event handler:

procedure TForm1.ApplicationEvents1ShowHint(var HintStr: string; var CanShow: Boolean;
  var HintInfo: THintInfo);
begin
  {Check here the HintInfo class, eg.
  if HintInfo.HintControl = MyControl then
    HintInfo.ReshowTimeout := ...
    HintInfo.HideTimeout := ... }
end;

Nincsenek megjegyzések:

Megjegyzés küldése