Click to See Complete Forum and Search --> : ToolTips


PUM
February 22nd, 2000, 11:21 AM
I need to create ToolTips in DialogBox
My Dialog box contains:
1)PushButtons
2)CheckBoxes
3)ComboBoxes

I've done such thing:
1)
BOOL CMyDialogBox::OnInitDialog()
{
......
......
EnableToolTips(true)
......
}

2)
BEGIN_MESSAGE_MAP (CMyDialog, CDialog)
.....
.....
ON_NOTIFY_EX(TTN_NEEDTEXT,0,OnTTip)
END_MESSAGE_MAP()

3)
BOOL CMyDialog::OnTT(UINTidFrom,NMHDR*hdr,LRESULT *ResultNotUsed)
{
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)hdr;
UINT nID = pTTT->hdr.idFrom;
pTTT -> lpszText = "TEST";
return(true);
}

It works for PUSH BUTTONS ONLY
But it dosen't work for comboboxes,lables and checkboxes.
Please help me.
Thank you.
Alex

Nuno Tavares
February 22nd, 2000, 11:36 AM
While there isn't a better answer, see if this helps:

http://mfcfaq.stringray.com/


--
Nuno Tavares
http://nthq.cjb.net

February 28th, 2000, 11:27 AM
Ther is some mistake I can't enter this www :-(

February 28th, 2000, 02:26 PM
It works on NT…
Try this (from my test program):


BOOL CToolTipsDlg::OnTTip(UINT id, NMHDR* pNMHDR, LRESULT *pResult)
{
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT*)pNMHDR;

UINT nID = pNMHDR->idFrom;
if ((pNMHDR->code == TTN_NEEDTEXT) && (pTTTA->uFlags & TTF_IDISHWND)
{
// idFrom is the HWND of the tool
nID = ::GetDlgCtrlID((HWND)nID);
}

pTTT->lpszText = "TEST";

return TRUE;
}