dcsimg

ToolTips for Modal Dialog controls

WEBINAR:
On-Demand

Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame


Implementing tooltips for a modal dialog's controls is pretty easy. Just add the following code to your dialog's OnInitDialog function and implement PreTranslateMessage.

Changes to header files


private:
 HICON m_hIcon;
 CToolTipCtrl m_tool;

Add to implementation file

	
void CToolTipDlg::OnInitDialog()
{
 // Create tooltip object
 m_tool.Create(this); 

 // Add tooltip to the control
 m_tool.AddTool(GetDlgItem(Dialog control ID here),tooltip as string); 

 // TRUE to show tooltips,FALSE to disable tooltips
 m_tool.Activate(TRUE); 
}
Using ClassWizard, implement the PreTranslateMessage member function and modify it as follows.
	
void CToolTipDlg::PreTranslateMessage(MSG* pMsg)
{
 m_tool.RelayEvent(pMsg);
}

That's it! You now have tooltips on the controls!

Date Last Updated: February 1, 1999



Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date