Add dynamic tooltips to buttons in dialog)

Source: Internet
Author: User

Add a dynamic prompt to the button in the dialog box

Adding tooltip to the button is simple:
  • 1. Add a ctooltipctrl variable to the button.

Class ctooltipbutton: Public cbutton
{
...
Protected:
Ctooltipctrl m_ctrltip;
...
}

  • 2. Set this tooltip:

Bool ctooltipbutton: inittooltip (INT nstringid)
{
Enabletooltips ();
M_ctrltip.create (this, tts_alwaystip );

M_ctrltip.setmaxtipwidth (10000 );
M_ctrltip.addtool (this, nstringid );
M_ctrltip.activate (true );

Return true;
}

  • 3. Response Message:

Bool ctooltipbutton: pretranslatemessage (MSG * PMSG)
{
M_ctrltip.relayevent (PMSG );

Return cbutton: pretranslatemessage (PMSG );
}

Implementing a dynamic tooltip is also simple

Use parameters when calling addtoolLpstr_textcallbackAnd parent response in tooltipTtn_needtext(That is, ttn_getdispinfo) Notify y message..

However, how do I provide dynamic prompts for buttons in the dialog box?

Simply combine the methods described in the above two articles. However, it cannot be found that, because as the parent of the tooltip, the corresponding wm_notify message should be included in the button. However, the button cannot receive the wm_notify message, even if it is the owner window of the tooltip.

What should I do? At this time, my solution is to move the ctooltipctrl from the button to the dialog so that the dialog becomes the parent of the tooltip, and it can get the wm_notify message.

Tooltip with more than 80 characters

Tooltip with more than 80 characters must also be usedLpstr_textcallbackIn the same way, the message wm_notify is returned. At this time, the button cannot be used as the parent of the tooltip.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.