7

I've earched for it but couldn't find anything. Is there any way to add a hint or tooltip with FireMonkey? Are there any components available that enable this?

Ideally I am looking for something like this (a callout type tooltip):

a callout type tooltip

To the moderators who have placed this question on hold: I am looking for lines of source code on how to achieve this, not a software to buy/use. There are currently (AFAIK) no source code components that enable doing this, so there is no risk of "opinionated anwers or spam".

Jamie
  • 657
  • 7
  • 18
  • 2
    german link http://www.delphipraxis.net/169747-brennende-hinweise-fmx-hints-thintmanager-1-3-a.html – Sir Rufo Mar 15 '14 at 00:06
  • Question to the close-voters: Is this a suitable question for http://softwarerecs.stackexchange.com? – Uli Gerhardt Mar 15 '14 at 07:04
  • Jamie, instead of such intensive editing you could go through the thread @SirRufo linked you to (I think you'll find your answer there), or spend some time thinking about how would you create such shapes by yourself. You've asked literally *"Are there any components available ?"* and so you should not be surprised that your question got closed with this reason (if there is an existing component or not doesn't matter in this case). – TLama Mar 15 '14 at 10:04
  • 1
    Did you also read the rest? **"Instead, describe the problem and what has been done so far to solve it."** - This question is currently **off-topic on SO** and should be reworded or closed or moved to another stackexchange site – Sir Rufo Mar 15 '14 at 15:34
  • 2
    I'd love to add an answer to this but it's on hold. The basic gist of the answer is that you'd add a `TCalloutPanel` and parent it to your `TEdit`. Then, align it to `alRight`, set width to 150, and set margin-right to -150 (or set it to negative of the same value as the width). Then set `CalloutOffset` to 1 and `CalloutPosition` to `cpLeft`. Sir Rufo's answer is a better route of course, but there's always other ways of doing this sort of stuff in FMX. – Scott P Mar 15 '14 at 16:42
  • Thanks Sir Rufo and Scott Pritchard for your answers! As for the on-hold status, you need to thank the moderators. – Jamie Mar 15 '14 at 21:19
  • 2
    @TLama:I first asked if there is any way to add a tooltip but you probably missed that question. Regarding my question: "are there any components available", if you use Delphi you know that this question includes standard components. Everything is a component in Delphi(buttons,edits), so my question doesn't explicitly ask for 3rd party components. As Scoot Pritchard pointed, a TCalloutPanel might be just what I need. And TCalloutPanel is a standard component. Cheers. – Jamie Mar 16 '14 at 11:17
  • This question was not closed by moderators. It's been closed by the listed users. But well, if @Scott wants to answer, I'm giving to your question my reopen vote... Now remains one vote to remove the on hold state. Just for the next time be careful how you phrase your question. You've asked for "any component" which includes also 3rd party solutions and that's not on-topic here. – TLama Mar 16 '14 at 11:33
  • Finally found an easy way to do it. Wish I could add an answer here but the question is closed as off-topic. – Jamie Mar 20 '14 at 23:03
  • @Jamie, feel free to do it now, the question is opened. – LU RD Mar 22 '14 at 07:57
  • @TLama The question was closed by moderators. Community moderators. As opposed to diamond moderators. High rep users are moderators. – David Heffernan Apr 28 '14 at 06:19
  • @jamie Please, add your answer, I am in huge need of the very same thing ! Thank you – Eduardo Elias May 23 '14 at 12:12
  • @ScottPritchard Do you mind adding your answer? It could be useful for me. Thanks – Eduardo Elias May 23 '14 at 15:45
  • @eelias: Just added an answer. – Jamie May 24 '14 at 13:12

3 Answers3

11

This is how I finally did it: to create a hint for a Button that looks like this:

enter image description here

Add a button to a form. Then add a TPopup. Drop a CalloutPanel inside it and optionally set the align to AlClient. The drop a TLabel on that CalloutPanel and write your hint text.

Your structure should look like this:

enter image description here

Then go to the TPopup and set PlacementTarget to Button1 (your button). Next, go to Placement and select BottomCenter:

enter image description here

Next add a handler for the MouseEnter and MouseLeave events on the button:

procedure TForm1.Button1MouseEnter(Sender: TObject);
begin
Popup1.IsOpen := True;
end;

procedure TForm1.Button1MouseLeave(Sender: TObject);
begin
Popup1.IsOpen := False;
end;

That should do it.

Jamie
  • 657
  • 7
  • 18
1

You can use FloatAnimation and Opacity property to make a hint.

Add a button to a form. Then add CalloutPanel (or any shape) inside. Next drop a TLabel on the CalloutPanel to write your hint text. I set CalloutPanel.Visible property to False at the Form Creating moment. Then attach a TFloatAnimation to a CalloutPanel.Opacity property.

Next set some TFloatAnimation properties:

Because of Duration Hint appears smoothly.

Then create Button events OnMouseEnter and OnMouseLeave .

procedure TForm1.Button1MouseEnter(Sender: TObject);
begin
   CalloutPanel1.Visible := true;
end;

procedure TForm1.Button1MouseLeave(Sender: TObject);
begin
   CalloutPanel1.Visible := false;
end;

That's it

Yulits
  • 11
  • 2
0

I am new to Delphi and FireMonkey. And I also wanted tool tips. And here is what I figured out: FireMonkey has no provision for tool tips, and this is deliberate and for good reason.

I think the big idea with FireMonkey is that you develop one and only one program. Then, without changing even one line of code, you compile a version to run on Windows, another version to run on Android, another version to run on Mac OS, etc. So without changing even one line of code, you have a version for Desktop and a version for Smartphones that work exactly the same way with the same user interface.

Therefore, FireMonkey is only going to support features that are common to both smartphones and desktops. On smartphones, there is no such thing as hovering a mouse, a finger, or anything else. Therefore, Firemonkey does not support hovering on desktops. Because there is no hovering, there can be no tooltips ('hints' in Delphi nomenclature).

So you have to decide: Do you want an app that works exactly the same in Windows and on smartphones, without changing the code and without having separate code? Or do you want all the desktop features? If you want all the desktop features, including tooltips (hints) and all the rest, then you should be using Embarcadero's VCL (Visual Component Library). Using VCL will allow you to get tooltips (hints) by just setting the 'hint' property of text boxes, buttons, and all the other controls--and without writing code.

But if you want an app that works on smartphones, you will have to use FireMonkey. VCL won't work for that.

As I mentioned, I'm still new to Delphi. So, of course, I appreciate corrections from experienced Delphi developers.

Indinfer
  • 532
  • 5
  • 4