Change the content of a tooltip
-
Hi all, i was looking for a way to change the tooltip of the toolbar's buttons !! i tried to look for it on google but there is nothing versatile. I'm using Visual Studio 2005 and an MFC project !! Thank you
"The Ultimate Limit Is Only Your Imagination."
-
Hi all, i was looking for a way to change the tooltip of the toolbar's buttons !! i tried to look for it on google but there is nothing versatile. I'm using Visual Studio 2005 and an MFC project !! Thank you
"The Ultimate Limit Is Only Your Imagination."
I believe you would want to send TTM_DELTOOL message to your existing tooltip control to delete the current text, followed by a TTM_ADDTOOL message with the new text. Alternatively, I think you can use TTM_SETTOOLINFO to modify the text of an existing tooltip - that may be simpler. The following snippet shows the syntax for TTM_ADDTOOL and may point you in the right direction, although the code is WTL instead of MFC:
TOOLINFO info; ZeroMemory(&info, sizeof(TOOLINFO)); info.cbSize = sizeof(TOOLINFO); info.hinst = \_Module.get\_m\_hInst(); info.uFlags = ( TTF\_CENTERTIP | TTF\_ABSOLUTE); info.lpszText = \_T("Your new text here."); m\_Toolbar.GetItemRect(m\_Toolbar.CommandToIndex(ID\_TOOLBAR\_BUTTON\_TO\_CHANGE ), &info.rect); info.hwnd = m\_Toolbar.m\_hWnd; info.uId = ID\_TOOLBAR\_BUTTON\_TO\_CHANGE; ::SendMessage(tt, TTM\_ADDTOOL, 0, (LPARAM)&info);// tt is the HWND of the tooltip control
L u n a t i c F r i n g e