How to use TTS_ALWAYSTIP with CToolBarCtrl?
-
Hello, I need to have the Tooltip displayed on the ToolBar even when its parent window is not active. I posted a message yesterday. I was told that I can set the TTS_ALWAYSTIP on the CToolTipsCtrl. But there is no CToolTipCtrl in my program I am using the following code and don't know how to set the TTS_ALWAYSTIP. BOOL CToolBarTipTestDialog::OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult) { ASSERT(pNMHDR->code == TTN_NEEDTEXTA || pNMHDR->code == TTN_NEEDTEXTW); // if there is a top level routing frame then let it handle the message if (GetRoutingFrame() != NULL) return FALSE; // to be thorough we will need to handle UNICODE versions of the message also !! TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR; TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR; TCHAR szFullText[512]; CString strTipText; UINT nID = pNMHDR->idFrom; Please help me. Thanks a lot in advance. Bin
-
Hello, I need to have the Tooltip displayed on the ToolBar even when its parent window is not active. I posted a message yesterday. I was told that I can set the TTS_ALWAYSTIP on the CToolTipsCtrl. But there is no CToolTipCtrl in my program I am using the following code and don't know how to set the TTS_ALWAYSTIP. BOOL CToolBarTipTestDialog::OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult) { ASSERT(pNMHDR->code == TTN_NEEDTEXTA || pNMHDR->code == TTN_NEEDTEXTW); // if there is a top level routing frame then let it handle the message if (GetRoutingFrame() != NULL) return FALSE; // to be thorough we will need to handle UNICODE versions of the message also !! TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR; TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR; TCHAR szFullText[512]; CString strTipText; UINT nID = pNMHDR->idFrom; Please help me. Thanks a lot in advance. Bin
You've obviously got a CToolBar control being created somewhere (In your CMainFrame, or Dialog). You can use:
CToolBar::GetToolBarCtrl
CToolBarCtrl& GetToolBarCtrl( ) const;Return Value
A reference to a CToolBarCtrl object
Then:
CToolBarCtrl::GetToolTips
CToolTipCtrl* GetToolTips( ) const;Return Value
A pointer to the CToolTipCtrl object associated with this toolbar or NULL if the toolbar has no associated tool tip control.
And Bob's your uncle. Iain.
-
You've obviously got a CToolBar control being created somewhere (In your CMainFrame, or Dialog). You can use:
CToolBar::GetToolBarCtrl
CToolBarCtrl& GetToolBarCtrl( ) const;Return Value
A reference to a CToolBarCtrl object
Then:
CToolBarCtrl::GetToolTips
CToolTipCtrl* GetToolTips( ) const;Return Value
A pointer to the CToolTipCtrl object associated with this toolbar or NULL if the toolbar has no associated tool tip control.
And Bob's your uncle. Iain.
-
I still don't understand. Will you please give me more details? Where can I put the TTS_ALWAYSTIP in? There is not CTooltipCtrl in my project.
Anonymous wrote: There is not CTooltipCtrl in my project. No there isn't, but I showed you how to get from your CToolbar object [*] to its CToolBarCtrl child object, to its child CToolTipCtrl object. You can then use ModifyStyle(Ex?) to set the TSS_ALWAYSTIP style. Read my previous message, and look the commands up in MSDN for exact details. Iain. [*] You must have one of these, or you wouldn't have a toolbar to worry about!