• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 737
  • Last Modified:

Tooltip formatting

Anybody know how to custom draw tooltips? I need to display a tooltip that is formatted: italics, bold, underline etc.
0
davelane
Asked:
davelane
  • 5
  • 3
  • 2
  • +1
1 Solution
 
Lukasz LachCommented:
0
 
davelaneAuthor Commented:
Looks good, but I really don't fancy going through the hassle of going after money to pay for it. Know of any free options?
0
 
Lukasz LachCommented:
THTMLHint is free for non-commercial use...
You use it like normal HTML:

<B>Bold</B><I>Italic</I><U>Underline</U>...
You can also insert images from ImageList and color the text, background, make margins... lot of stuff :-)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
davelaneAuthor Commented:
Yeah, looks great, if there is no other option then I will try to chase down some money for it here.

We would be using it commercially though, so would have to pay. Any other options?
0
 
steve_hskCommented:
Hi Dave ...

You have a couple of options :-
1. Write your own,
2. Use Freeware

For freeware components that have a good list of features, and most of which include sourcecode, I'd recommend :-
http://www.delphispirit.com/rd/Delphi/24/181

If you'd prefer to write your own, this isn't too complex, let us know exactly (!) what you need, and we'll try and throw something together :-)

Hope this helps,
Steve
0
 
MunimCommented:
Hello,
   How about baloon tooltip... with a bold titlebar, with an icon on left,and a multiline tip...

Munim
0
 
steve_hskCommented:
All ...

This is the best Freeware / OpenSource VCL Component out there that I have found for D3, D4, D5, D6, D7 :-

http://www.delphiarea.com/products/assistant/

It looks, and acts exactly like MS Office Assistant. It has animations, a variety of actors(which vary in size) to read the hint, languages translations, and all source code !

Any better :-) ?
Steve
0
 
steve_hskCommented:
ps ... I've just installed and compiled this component :-)

It requires another 3rd party component to be not installed, but to have the .PAS in the same directory as the assistant :-

http://www.the-hoskings.freeserve.co.uk/Off97Btn.htm

It is incredible !!! ... Apart from being a tad smaller, you couldn't askfor anymore ... it has everything !

Hope this was what you're looking for,
Steve
0
 
steve_hskCommented:
I'm on a role ... maybe ... or maybe not ;-) ...

http://www.the-hoskings.freeserve.co.uk/Off97Bln.htm

Is a lighter Balloon Hint App with full source code.

It's not a component, but does include a demo project on how to use.

Adding font or italic tags would be relatively straight forwards !

Finally a really nice example which needs a component  wrapper, but works as a nice general balloon tip code :-

http://www.swissdelphicenter.com/en/showcode.php?id=1555

const
  TTS_BALLOON    = $40;
  TTM_SETTITLE = (WM_USER + 32);

var
  hTooltip: Cardinal;
  ti: TToolInfo;
  buffer : array[0..255] of char;
   
{....}

procedure CreateToolTips(hWnd: Cardinal);
begin
  hToolTip := CreateWindowEx(0, 'Tooltips_Class32', nil, TTS_ALWAYSTIP or TTS_BALLOON,
    Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT), Integer(CW_USEDEFAULT),
    Integer(CW_USEDEFAULT), hWnd, 0, hInstance, nil);
  if hToolTip <> 0 then
  begin
    SetWindowPos(hToolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or
      SWP_NOSIZE or SWP_NOACTIVATE);
    ti.cbSize := SizeOf(TToolInfo);
    ti.uFlags := TTF_SUBCLASS;
    ti.hInst  := hInstance;
  end;
end;

procedure AddToolTip(hwnd: DWORD; lpti: PToolInfo; IconType: Integer;
  Text, Title: PChar);
var
  Item: THandle;
  Rect: TRect;
begin
  Item := hWnd;
  if (Item <> 0) and (GetClientRect(Item, Rect)) then
  begin
    lpti.hwnd := Item;
    lpti.Rect := Rect;
    lpti.lpszText := Text;
    SendMessage(hToolTip, TTM_ADDTOOL, 0, Integer(lpti));
    FillChar(buffer, SizeOf(buffer), #0);
    lstrcpy(buffer, Title);
    if (IconType > 3) or (IconType < 0) then IconType := 0;
    SendMessage(hToolTip, TTM_SETTITLE, IconType, Integer(@buffer));
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  CreateToolTips(Form1.Handle);
  AddToolTip(Memo1.Handle, @ti, 1, 'Tooltip text', 'Title');
end;

{
IconType can be:

 0 - No icon
 1 - Information
 2 - Warning
 3 - Error
}

Steve

0
 
davelaneAuthor Commented:
OK Steve, better give you the points before you give me any more information :-) That was great, don't you guys have jobs? :-)
0
 
steve_hskCommented:
Glad it helped Dave ...

<< leg in plaster ... way too much time on my hands :-)

Thanks for the points  !!!
Steve
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now