How to display tool tips...
-
I want to show CToolTipCtrl object when user enters invalid character. Actually i want to use that class when i want. But i cant find a solution. Is there anyway to override that functionality. I use several methods, but cant do what i want. I use ShowWindow like funtctions, but they just show and disappear. They dont even there for a few miliseconds:) Being mortal is what makes impossible possible.
-
I want to show CToolTipCtrl object when user enters invalid character. Actually i want to use that class when i want. But i cant find a solution. Is there anyway to override that functionality. I use several methods, but cant do what i want. I use ShowWindow like funtctions, but they just show and disappear. They dont even there for a few miliseconds:) Being mortal is what makes impossible possible.
i)declare CToolTipCtrl in ur class like CToolTipCtrl m_ToolTipCtrl ; ii) add the following code in constructor TOOLINFO ti; DWORD dwStyle = TTS_BALLOON; m_ToolTipCtrl .Create(this, dwStyle); m_ToolTipCtrl .FillInToolInfo(ti, this, 0); ti.uFlags |= (TTF_TRACK |TTF_ABSOLUTE ); ti.lpszText = (LPTSTR)_T("Enter Valid Phone number"); m_ToolTipCtrl .SendMessage (TTM_ADDTOOL, 0,reinterpret_cast (&ti)); iii) add the following code, where u want to show the tooltip LPTSTR lpszMessage = _T("Enter Tooltip text here"); m_ToolTipCtrl.Activate(TRUE) ; CToolInfo ti; m_ToolTipCtrl.GetToolInfo(ti, this, 0); ti.lpszText = lpszMessage; m_ToolTipCtrl .SetToolInfo(&ti); m_ToolTipCtrl .SendMessage (TTM_TRACKPOSITION, 0, MAKELPARAM(rect.right - 20, rect.CenterPoint().y)); m_ToolTipCtrl .SendMessage (TTM_TRACKACTIVATE, TRUE,reinterpret_cast(&ti)); this code i got from some post for more info follow this link http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/tooltip/usingtooltips.asp naren VC++ programmer
-
i)declare CToolTipCtrl in ur class like CToolTipCtrl m_ToolTipCtrl ; ii) add the following code in constructor TOOLINFO ti; DWORD dwStyle = TTS_BALLOON; m_ToolTipCtrl .Create(this, dwStyle); m_ToolTipCtrl .FillInToolInfo(ti, this, 0); ti.uFlags |= (TTF_TRACK |TTF_ABSOLUTE ); ti.lpszText = (LPTSTR)_T("Enter Valid Phone number"); m_ToolTipCtrl .SendMessage (TTM_ADDTOOL, 0,reinterpret_cast (&ti)); iii) add the following code, where u want to show the tooltip LPTSTR lpszMessage = _T("Enter Tooltip text here"); m_ToolTipCtrl.Activate(TRUE) ; CToolInfo ti; m_ToolTipCtrl.GetToolInfo(ti, this, 0); ti.lpszText = lpszMessage; m_ToolTipCtrl .SetToolInfo(&ti); m_ToolTipCtrl .SendMessage (TTM_TRACKPOSITION, 0, MAKELPARAM(rect.right - 20, rect.CenterPoint().y)); m_ToolTipCtrl .SendMessage (TTM_TRACKACTIVATE, TRUE,reinterpret_cast(&ti)); this code i got from some post for more info follow this link http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/tooltip/usingtooltips.asp naren VC++ programmer
narendra_ b; thank you very much for your help. I've been working on it for hours but couldn't find the solution. Your code works very good.