When the user's mouse pointer touch a button I want a message to appear telling the user what that button's function is.
Wich function do I use?

Thanks

Recommended Answers

All 4 Replies

Check out the ToolTip property. That's what it's for. You enter a string, and on hover a tooltip will appear with that string.

Yes, the property is called Hint in Delphi but it is the same thing.

You will need to set the ShowHint property for the button or for the form, dependiing on how you want things to behave. Controls have a ParentShowHint property to control whether the control follows their parents ShowHint setting or their own.

Also note that you can have a brief hint displayed at the button (or other control) and a longer hint displayed elsewhere - like in a status bar. Try this:

Start a new project.
Add a button and a status bar.
Set the hint property for the button to be:
Short hint|More detailed explanation
Set the ShowHint property for the form to TRUE.
In the form's onCreate event put:

procedure TForm3.FormCreate(Sender: TObject);
begin
  Application.OnHint := ApplicationHint;
end;

Then add an ApplicationHint method:

procedure TForm3.ApplicationHint(Sender: TObject);
begin
  Statusbar1.SimpleText := GetLongHint(Application.Hint);
end;

Now when you put the mouse over the button you should get a short hint at the button and a longer message in the statusbar.

commented: Thanks :) +2

Yes, the property is called Hint in Delphi but it is the same thing.

Thanks. It's been a while...

Thanks guys! xx :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.