|
-
November 10th, 2003, 10:04 AM
#1
tooltips in a dialog
I want to show tooltips when the user has the cursor over the dialog controls, so firstly I call EnableToolTips(),
Then I call the tooltipOnNotify, for some reason it only gets into the OnToolTipNotify function for certain controls & won't get into the function when the cursor is over a check box or a static control or a radio button...., so the question is what do I have to do to get the tooltip over all controls
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify)
BOOL CDialog::OnToolTipNotify(UINT id, NMHDR *pNMHDR,LRESULT *pResult)
{
TOOLTIPTEXTA *pTTTA = (TOOLTIPTEXTA *)pNMHDR;
TOOLTIPTEXTW *pTTTW = (TOOLTIPTEXTW *)pNMHDR;
CString strTipText;
UINT nID = pNMHDR->idFrom;
if (pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) ||
pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND))
{
// idFrom is actually the HWND of the tool
nID = ::GetDlgCtrlID((HWND)nID);
}
if (nID != 0) // will be zero on a separator
strTipText.Format("Control ID = %d", nID);
*pResult = 0;
if (pNMHDR->code == TTN_NEEDTEXTA)
{
lstrcpyn(pTTTA->szText, strTipText, sizeof(pTTTA->szText));
}else //unicode
{
_mbstowcsz(pTTTW->szText, strTipText, sizeof(pTTTW->szText));
}
return TRUE; // message was handled
}
-
November 10th, 2003, 10:46 AM
#2
why do not you use CToolTipCtrl. this class is much easier to integrate into your dialog code
-
November 10th, 2003, 10:53 AM
#3
Can you please show me sample code on how to implement it in my dialog.
Thanks
-
November 10th, 2003, 12:30 PM
#4
-
November 11th, 2003, 09:48 AM
#5
Thanks alot for that link to the toolTip information, it worked great
Thanks again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|