tags:

views:

4223

answers:

4

On input validation, I'm using balloon tips instead of message boxes. My problem is that on Vista, they have the old XP style with the rounded corners, not the newer more rectangle like appearance.

I've tried creating them using CreateWindowEx and tooltips_class32 or showing the Edit's associated balloontip using SendMessageW and EM_SHOWBALLOONTIP, the result is the same. Doing the same thing in Visual Studio and C# results in a Vista style balloon tip.

You can see an example of the balloon hint I need, when you toggle Caps Lock while in a password edit, like the one on the Windows Logon.

+2  A: 

As can be read in Delphi 2009 reviewers guide each VCL component now has a CustomHint property. It can be set to any descendant of TCustomHint.

Be sure to enable baloon hints in Vista else they won't show.

Gamecat
I use them instead of error messages, not like hints.
atika
How do you do that? I tried here but wasn't able to figure out how to show the hint at will.
Fabio Gomes
http://www.swissdelphicenter.ch/en/printcode.php?id=2279
atika
http://www.delphitricks.com/source-code/forms/show_balloon_tooltips_in_my_delphi_program.html
atika
+9  A: 
Roddy
A: 

The TCustomHint in Delphi 2009 has four protected overloads of ShowHint that when called allow you to place the TCustomHint on demand and in specific locations:

procedure ShowHint; overload;
procedure ShowHint(Point: TPoint); overload;
procedure ShowHint(Rect: TRect); overload;
procedure ShowHint(Control: TControl); overload;

All you need to do is implement a hint in the style you want (or just descend from TBalloonHint if it is close enough) and make those methods public to have the ability to place a hint where-ever and when-ever you want.

Note: Change the Title property of the TCustomHint to change what text is displayed, unless you use the ShowHint that takes a TControl as an argument. In that case it gets it from the control's Hint property (and places it in the Title property of the TCustomHint).

Jim McKeeth
A: 

Great answer! This one was killing me!

But?! what about the box height? how can I make it bigger?