Adding Tooltip to any control in your Dialog (multiline)

This class helps the user in adding tooltip to any control in the dialog. Tooltip information can be more than one line.
  1. Add MFECToolTip.h and MFECToolTip.cpp in your project
  2. In OnInitDialog, call the Create function and add the tooltip information to any control you would like to have.

    For example:
    In SampleDlg.h add a variable

               MFECToolTip m_toolTip;
    

    In SampleDlg.cpp
           SampleDlg::OnInitDialog()
            {
                m_toolTip.Create( this );    // after creating, add the information
                m_toolTip.AddControlInfo( contol_ID, information, background_color, text_color );
                // control ID is of type UINT
                // information is of type CStringArray.
                // background_color and text_color are optional
            }
    
  3. Override the dialog's PreTranslateMessage to handle mouse movement.
    BOOL CToolTipExDlg::PreTranslateMessage( MSG *pMsg )
    {
            if( pMsg->message == WM_MOUSEMOVE )
            {
                    POINT pt = pMsg->pt;    
                    ScreenToClient( &pt );
    
                    // this is the only function to call
                    m_toolTip.ShowToolTip( (CPoint)pt );
            }
    
            return CDialog::PreTranslateMessage(pMsg);
    }
    
  4. explicitly show the tooltip in a particular control, call ShowToolTip( controlID ) with control ID as parameter. Make sure you call AddControlInfo() to add information for this control, otherwise no tooltip is displayed.
  5. Delete or remove the existing tooltip information, call RemoveControlInfo( controlID ) and pass the control ID. If not found nothing happens.
  6. So, you can add and remove tooltip at runtime. Try!

Download demo project - 58 KB

Download source - 3.4 KB

IT Offers

Comments

  • Nike Zephyr Max 1 FB press, have on the agenda c trick a eager color grain, the unheard of shoes

    Posted by Geozyoceada on 04/25/2013 07:08am

    In the summer in a glass interior the imperturbable sprite seems to be a decorous choice, but if the sprite "feet"? Inclination also supply you a set off, get a invigorating! This summer, Nike and Sprite [url=http://markwarren.org.uk/goodbuy.cfm]nike free run[/url] and his sneakers to a graduate of exemplary snow spread of callow, unsullied and dejected color scheme in the undying Nike Superciliousness Max 1 shoes romp a like a breath of fresh air cool scent.[url=http://northernroofing.co.uk/roofins.cfm]nike free[/url] Summer is the metre to pick a moral shoe, shoes should be a creditable choice. Qualifying series Nike Quality Max HomeTurf city recently at the end of the day comes up, this series in the first-rate Melody Max shoes to London, Paris and Milan the three paid glorification to the iconic see of Europe, combined with the characteristics of the three cities, Air Max 1 HYP,Allied Max 90 HYP,Air Max 1 and shoes such as Air Max 95, combined [url=http://markwarren.org.uk/goodbuy.cfm]nike free uk[/url] with the Hyperfuse, as marvellously as a collection of materials, such as suede, Whether you want going or retro-everything.

    Reply
  • Lightweight bright – Nike Free TR Attack in jump 2013 3 series

    Posted by Tufffruntee on 04/22/2013 03:32am

    Nike Free TR Trim 3 prominent features is to exploit the brand-new design: Nike Self-ruling 5 soles improved bending Gouge; stylish tractor layout making training more focused when; lighter preponderance, the permeability is stronger, and more fashionable shoe designs not just order shoes [url=http://northernroofing.co.uk/roofins.cfm]nike free run uk[/url] more comfortable wearing, barefoot training have compassion for incline, but also more stylish appearance. Nike Manumitted TR Then 3 provides first-class lateral solidity, you can take the legs in the leg during training. Strong vamp majuscule letters breathable grating, demean sparkle's solitary map can be [url=http://fossilsdirect.co.uk/glossarey.cfm]nike huarache free[/url] seen through it. Lightweight, rugged, piddling soap up matter familiar by completely few seams, more amenable, support is stronger. Demand more support, factor of a training irritate, foam come in more parts of the need championing flexibility, foam loose. Use stand-in say nothing moisture wicking fake materials, tiresome on your feet, refrain from maintain feet sear and comfortable. Phylite [url=http://markwarren.org.uk/property-waet.cfm]air max 90 uk[/url] midsole offers lightweight shock sustained, famous durability and unbroken outsole can do to greatly lower the all-embracing weight of the shoe. Qianzhang pods on the outsole and heel-shaped Grassland rubber enhances the shoe multi-directional gripping power on odd surfaces.

    Reply
  • How we can Add MFECToolTip.h and MFECToolTip.cpp in our project ?

    Posted by Legacy on 01/02/2003 12:00am

    Originally posted by: ashkan

    How we can Add MFECToolTip.h and MFECToolTip.cpp in our project ?
    I have inserted this files to my project but I cant have
    an object from CMFECToolTip because visualc++6 make an error from command #include "MFECToolTip.h" in MyProjectView
    I guess my method of adding a file to project is incorrect
    please guide me how can i add MFECToolTip.h and MFECToolTip.cpp files in my project ?
    thanks in advance,

    Reply
  • Use the MFC Tooltip Control, it works much simpler.

    Posted by Legacy on 09/18/2002 12:00am

    Originally posted by: Conrad Braam

    Use the MFC Tooltip Control, it works much simpler.

    Reply
  • it swallows resources

    Posted by Legacy on 08/05/2002 12:00am

    Originally posted by: Michael Aumer

    Hi,

    I use your tooltip and found out, that it swallows resources when being painted. You can check this out, by using the Resource Monitor (Win95/98Me only).

    Until today, I haven't found out why this happens. Can anybody give me some hints ?

    Thanks in advance...

    Michael

    Reply
  • Well

    Posted by Legacy on 10/19/2001 12:00am

    Originally posted by: Victor

    The thank all works perfectly

    Reply
  • How about propertypages

    Posted by Legacy on 07/27/2000 12:00am

    Originally posted by: RccH

    How to use this in propertypages?

    Reply
  • Do not working tooltip?

    Posted by Legacy on 02/07/2000 12:00am

    Originally posted by: D. Utenkov

    Check tab order of your controls.

    Be sure that your tipped controls has lower tab number.
    In detail : see ChildWindowFromPoint() method description.

    Good luck!

    Reply
  • Tooltip will overwrite my frame

    Posted by Legacy on 01/05/2000 12:00am

    Originally posted by: Eric Lee

    I use this tooltip on check box.
    When the check box is click, I draw a blue frame on check
    box to indicate the status was changed.

    If I move mouse to check box and the tooltip will popup.
    Tooltip will overwrite my blue frame, how can I do to solve
    this problem?

    Thanks a lot!

    Regards,
    Eric Lee

    Reply
  • Not working on CBitmap controls ...

    Posted by Legacy on 11/02/1999 12:00am

    Originally posted by: Amir Meshy

    I created a CBitmap control and assigned a tooltip on it.
    Unfortunatly this does not work.
    Any thought why ?

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Go Deeper

  • This buyers guide provides independent research and test results to help you determine your endpoint protection requirements and identify …
  • This interactive white paper from CIO Magazine and EMC lays out the benefits of big data and predictive analytics, provides tips on how to …
  • When the economy is stable, a company's IT organization may view Finance as just one of many internal customers competing for attention. But …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds