Martijn Tonies
Martijn Tonies

Reputation: 473

Forcing a non blocking temporary hint window in Delphi

I've been searching, but cannot find a solution so I figured perhaps I should simply post it.

Here's what I'd like to do, in Delphi (2009):

At a certain moment in my application, I'd like to show a message to the user.

This should be the normal hint window, which automatically disappears after the normal application defined hint pause, with a custom message (and have it automatically sized etc etc).

This should be non blocking, like a normal hint, not dependent on the current control or whatever.

"Just show the damn message", in the Application hint window and carry on.

Any clues?

Upvotes: 7

Views: 1751

Answers (2)

Sertac Akyuz
Sertac Akyuz

Reputation: 54832

You can use a CustomHint:

with TCustomHint.Create(Self) do begin
  Title := 'temporary message';
  Delay := 0;
  HideAfter := 2000;
  ShowHint(Point(X, Y));
end;

However it is not destroyed at the time it's hidden, but when its owner (Self) is destroyed. But you can of course re-use the same hint instance.

Upvotes: 12

David Heffernan
David Heffernan

Reputation: 613572

You can use THintWindow for this. Create an instance of THintWindow and when you want to show the window call ActivateHint. When you are ready to close the window call ReleaseHandle. If you want to have the hint window close after a period of time, you'll want to run a timer to allow you the opportunity to ReleaseHandle when time is up.

Upvotes: 1

Related Questions