From: kathy on 21 Jan 2010 10:27 I try to add tooltips for my controls on a dialog application. in OnInitDialog(), I add : EnableToolTips(TRUE); Then I add ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify) in message map: BEGIN_MESSAGE_MAP(CMFC_ZoomDlg, CDialog) .... ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify) .... END_MESSAGE_MAP() and: BOOL CMFC_TestDlg::OnToolTipNotify( UINT unId, NMHDR *pstNMHDR, LRESULT *pstResult ) { UNUSED_ALWAYS (pstResult); UNUSED_ALWAYS (unId); TOOLTIPTEXT* pstTTT = (TOOLTIPTEXT * )pstNMHDR; UINT nID = pstNMHDR->idFrom; if ((pstTTT->uFlags & TTF_IDISHWND)) { // idFrom is actually the HWND of the tool nID = ::GetDlgCtrlID((HWND)nID); pstTTT->lpszText = _T("Hello"); pstTTT->hinst = AfxGetResourceHandle(); return(TRUE); } return (FALSE); } On my dialog, I have some EditBox, RadioButton, Button ComboBox. But some control show tooltips and others not. Could someone tell me why?
From: kathy on 21 Jan 2010 10:44 On Jan 21, 9:27 am, kathy <yqin...(a)yahoo.com> wrote: > I try to add tooltips for my controls on a dialog application. > > in OnInitDialog(), I add : > > EnableToolTips(TRUE); > > Then I add ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify) in message > map: > > BEGIN_MESSAGE_MAP(CMFC_ZoomDlg, CDialog) > ... > ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify) > ... > END_MESSAGE_MAP() > > and: > > BOOL CMFC_TestDlg::OnToolTipNotify( UINT unId, NMHDR *pstNMHDR, > LRESULT *pstResult ) > { > UNUSED_ALWAYS (pstResult); > UNUSED_ALWAYS (unId); > TOOLTIPTEXT* pstTTT = (TOOLTIPTEXT * )pstNMHDR; > UINT nID = pstNMHDR->idFrom; > if ((pstTTT->uFlags & TTF_IDISHWND)) > { > // idFrom is actually the HWND of the tool > nID = ::GetDlgCtrlID((HWND)nID); > > pstTTT->lpszText = _T("Hello"); > pstTTT->hinst = AfxGetResourceHandle(); > return(TRUE); > } > return (FALSE); > > } > > On my dialog, I have some EditBox, RadioButton, Button ComboBox. But > some control show tooltips and others not. Could someone tell me why? I find the controls with no tooltips are controls with tab order bigger than the Group control tab order. How to set tooltips with any tab order.
From: John H. on 21 Jan 2010 19:29 On Jan 21, 9:27 am, kathy <yqin...(a)yahoo.com> wrote: > > BEGIN_MESSAGE_MAP(CMFC_ZoomDlg, CDialog) > ... > ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify) > ... > END_MESSAGE_MAP() > > and: > > BOOL CMFC_TestDlg::OnToolTipNotify( UINT unId, NMHDR *pstNMHDR, Your BEGIN_MESSAGE_MAP specifies CMFC_ZoomDlg where as your OnToolTipNotify is defined for CMFC_TestDlg. I can't tell if you have some inheritance going on here, but when I do these they are normally for the same class.
From: kathy on 22 Jan 2010 10:55 On Jan 21, 6:29 pm, "John H." <oldman_fromt...(a)yahoo.com> wrote: > On Jan 21, 9:27 am,kathy<yqin...(a)yahoo.com> wrote: > > > > > BEGIN_MESSAGE_MAP(CMFC_ZoomDlg, CDialog) > > ... > > ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify) > > ... > > END_MESSAGE_MAP() > > > and: > > > BOOL CMFC_TestDlg::OnToolTipNotify( UINT unId, NMHDR *pstNMHDR, > > Your BEGIN_MESSAGE_MAP specifies CMFC_ZoomDlg where as your > OnToolTipNotify is defined for CMFC_TestDlg. I can't tell if you have > some inheritance going on here, but when I do these they are normally > for the same class. Sorry, both place should be CMFC_TestDlg.
From: some dude on 22 Jan 2010 13:54 Do you have: if (m_pToolTip) m_pToolTip->RelayEvent(pMsg); IN: CMFC_TestDlg::PreTranslateMessage(MSG* pMsg) ?
|
Pages: 1 Prev: Developing apps for Win 64 bit platforms Next: Parsing CSV files |