PDA

View Full Version : Hints/tooltips


GenExx
10-28-2001, 10:07 AM
Hi,

How can I make a tooltip uppdate it self when I want to?
For example, I have set the the "show hint" property for a progressbar to true. The progressbar changes on a timer event. And also, on timer, I set the hint to the progressbar value. But when the progressbar changes, and the hint is still visible, it is not changed... Is there any way to make it re-paint, or something similar?

Thanks in advance

gLes
10-28-2001, 12:58 PM
Try this code:

<tt>unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, ComCtrls;

type
TForm1 = class(TForm)
ProgressBar1: TProgressBar;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ApplicationShowHint(var HintStr: string; var CanShow: Boolean; var HintInfo: THintInfo);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
ProgressBar1.StepIt;
ProgressBar1.Hint := IntToStr(ProgressBar1.Position);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnShowHint := ApplicationShowHint;
end;

procedure TForm1.ApplicationShowHint(var HintStr: string; var CanShow: Boolean; var HintInfo: THintInfo);
begin
HintInfo.ReshowTimeout := 200;
end;

end.</tt>

gLes:)

"Small step for me, but large step for all Delphi developers!"
/gLes@hab.hu/

Remeber all who have died at the WTC and let those responsible get the punishment they deserve!

GenExx
10-29-2001, 01:46 AM
Beatufull, gLes... Thanks!

GenExx
10-29-2001, 01:48 AM
Grr, those spelling errors, and you can't edit your own post... =)