Click to See Complete Forum and Search --> : Can we Create user shaped tooltips in VB


November 24th, 1999, 04:24 PM
Normally we have a rectangle shape to display a tooltip text in vb. Can we create our own shape like we have in Lotus Notes where u get ballon tooltips.
Is it possible by some way to simulate this.

Sandra

psiclone
November 24th, 1999, 04:32 PM
Yes you can. There are third party OCXs that do the job, or you can do it the hard way... making another form and shaping it to look like your tooltip using SetWindowRgn API. Normally it is hidden but it is displayed when the user moves the mouse over a certain control.

psiclone

November 24th, 1999, 04:35 PM
Do u have any idea about what are the third party OCX's available which can solve my purpose.

psiclone
November 24th, 1999, 04:45 PM
Sorry, I'm afraid I use the second method more. I can suggest a VBX for VB3 though - DBTTip.vbx, I don't know if a newer version is available as an OCX for VB5/6.
Search for "OCX","tooltip" and "shape" at the major search engines. You're bound to find something. Or if you know someone who is a VB expert or a good C programmer, you could get them to write one for you... It's not that hard, honest!

psiclone

Ravi Kiran
November 25th, 1999, 05:29 AM
Just an idea... i dont know how far this is feasible..

If you can get the handle of the too-tip window ( which is after all a window), you can set its window region to non-rect region,and it should show in that shape, next time on!, unless somewhere inside he is correcting the shape back ( which i dont think so).

So abt how to get the tool tip text window handle: one possible ( not so clear/n ) route: before the tool tip is shown, every parent window (ie the control for which it is going to show the tip) recieves a TTN_SHOW message, and this message will have a hWndfrom parameter which will be toop-tip window's handle. You can catch this, and try. and BEST OF LUCK :-) save your work every often..

RK

Chris Eastwood
November 25th, 1999, 05:32 AM
Ravi & Others...

you might be able to use some of the code from http://codeguru.developer.com/vb/articles/1944.shtml to get and modify the tooltip window.

This sample show's how to have a true multi-line tooltip control, so once you have the handle, in theory Ravi's idea should work.


Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb

Ravi Kiran
November 25th, 1999, 05:53 AM
Ah hooooo....

IT WORKS !:-)

Just add 2 lines to the code in that article, in the class initialise, after creating the window:


m_Elrgn = CreateEllipticRgn(0, 0, 100, 100)
If m_Elrgn <> 0 then
SetWindowRgn m_hwndTT, m_Elrgn, false
End If



with their defs pickedup from API viewer
and it works.. shows an elliptic tool tip. i guess now we can make any kind of region to work with

RK

Ravi Kiran
November 25th, 1999, 06:00 AM
correction:
1. Not in Class_initialise but in Create function.
Public Function Create(frm As Form) As Boolean

2. You need to do the cleaning up of stuff also
3. To get a better look more need to be done to adjust the size as per the case.
That was just a little euphoria.. i am off for the day. bye


RK

Ravi Kiran
December 8th, 1999, 01:32 AM
Yes it is possible, and no need for 3rd party controls.:-)
---
Based on Bred Martinez Code pointed by Chris (look at the complete thread), I expanded the idea and we have added a new page to Code Guru site on this.


To know what you get, take a look at:

http://www.codeguru.com/vb/articles/1967.shtml

Many thanks to Chris Eastwood for his help.

Ravi Kiran

RK