TBalloonHint in Delphi


Here in this blog, I will explain how to display hints using the TBalloonHint component. Balloon hints simply display a hints then disappear after a short period of time. BalloonHint component is added to show hint in balloon style. TBalloonHint typically has a bhsBalloon style property which defines style of hint. Title and Description property is used for hint Title and hint description.


Properties
Specifies the delay before displaying the hint.
Provides the description of a hint
Specifies the time to wait before hiding the hint.
Specifies the index in the image list.
Specifies the list of images that can be displayed with the hint.
Specifies whether the hint is displayed.
Specifies the style of the custom hint.
Specifies the hint's title.

Methods
Hides the hint.
Method used to show the hint.

You can find TBalloonHint in ‘Additional’ section of the tool panel so it can be added to a form at design time. Hints are automatically displayed when the cursor is over a control. The HideAfter property allows you to specify, in ms, how long the balloon will be shown before it is automatically hidden.  The Delay property allows you to specify, in ms, how long the hint should wait before appearing; the default this value is 500.

Example
procedure TForm1. Button1Click (Sender: TObject);
begin
  BalloonHint1.Title := 'My Test Title';
  BalloonHint1.Description := 'This is my test message description';
  BalloonHint1.Style := bhsBalloon;
  BalloonHint1.HideAfter := 2000;
  BalloonHint1.ShowHint(Button1);
//BalloonHint1.ShowHint(ClientToScreen(Tpoint.Create(Button1.Left,Button1.Top)));
end;

When to Hide Just set Hideafter

Example….
procedure TForm2.FormCreate(Sender: TObject);
begin
  balloonhintTest.HideHint;
  balloonhintTest.Style := bhsStandard;
end;





Comments

  1. BalloonHint1.ShowHint(ClientToScreen(Tpoint.Create(Button1.Left,Button1.Top))); It helped me for a Keyboard and with this show the key pressed. Thanks for the tip!

    ReplyDelete

Post a Comment

Popular posts from this blog

MS Excel Automation in Delphi

ShellExecute in Delphi

Drawing Shapes in Delphi