In MFC (old I know), I am trying to add a Tooltip that appears only when a radio button is disabled.
I am able to show the tooltip with code such as:
m_ToolTip.Create(this);
m_ToolTip.AddTool(GetDlgItem(IDC_RADIOBUTTON), "Tooltip text");
m_ToolTip.Activate(TRUE);
But it does not work when my radio button is disabled, (apparently that is by design)
After some research it appears that I need to override the
PreTranslateMessage()
function to get the ToolTip showing, perhaps tracking when the mouse enters into the control area, but I don't know how to do that.
Any help much appreciated.
BOOL MyDialog::PreTranslateMessage(MSG* pMsg)
{
// GF: Fix tooltips on disabled items.
m_wndCtrl.RelayEvent(pMsg->message, pMsg->wParam, pMsg->lParam);
m_wndCtrl.UpdateWindow();
return CDialog::PreTranslateMessage(pMsg);
}
This works for me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.