How do you use the CToolTipCtrl?
-
Can somebody show me how to use the tool tip control in a dialog app? Could Microsoft have made this any harder?
Create a member function in your head file... CToolTipCtrl m_ToolTips; then..... BOOL CJVFAccessDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class switch(pMsg->message) { case WM_LBUTTONDOWN: case WM_LBUTTONUP: case WM_MOUSEMOVE: m_ToolTips.RelayEvent(pMsg); } return cdxCSizingDialog::PreTranslateMessage(pMsg); } BOOL CJVFAccessDlg::OnInitDialog() { m_ToolTips.Create(this); m_ToolTips.SetDelayTime(200); m_ToolTips.SetDelayTime(TTDT_AUTOPOP, 50000); m_ToolTips.SetMaxTipWidth(200); m_ToolTips.AddTool(GetDlgItem(IDD_REPORTS), winmesgs[7]); m_ToolTips.AddTool(GetDlgItem(IDD_PERSONNEL), winmesgs[8]); : : etc etc etc return TRUE; }
-
Can somebody show me how to use the tool tip control in a dialog app? Could Microsoft have made this any harder?
There are two MSDN documents that cover this: "How to Add Tooltips for Controls to an MFC Modal Dialog Box" (on the CD set) - and - "Tiptoe Through the ToolTips With Our All-Encompassing ToolTip Programmer's Guide" (http://msdn.microsoft.com/library/periodic/period97/S245A9.htm) Also, it is a good idea to put in an option to turn off tooltips in your dialog boxes. They can get annoying once you are familiar with using the application. Good Luck Jonathan Craig