from the implementation of CDerivedEdit. It mean that you may be doing
something in CDerivedEdit that is causing the problem.
AliR.
On Jul 21, 1:03 pm, "Mark Salsbery [MVP]"
<MarkSalsbery[MVP]@newsgroup.nospam> wrote:
If you want your edit control's OnToolTipNotify() to be called then
you'll
need to use ON_NOTIFY_REFLECT in the control's message map. Note that
the
handler function return value changes to void.
Mark
--
Mark Salsbery
Microsoft MVP - Visual C++<przemyslaw.sl...@gazeta.pl> wrote in message
news:1184979416.463503.179150@q75g2000hsh.googlegroups.com...
On Jul 21, 1:08 am, "Mark Salsbery" <msalsb...@sbcglobal.net> wrote:
I see your class declaration but what's going on in the
implementation?
How is your OnToolTipNotify() method getting called?
Mark
--
Mark Salsbery
Microsoft MVP - Visual C++
<przemyslaw.sl...@gazeta.pl> wrote in message
news:1184972830.203511.41870@n2g2000hse.googlegroups.com...
Hello,
Thanks for answer, I have already said I have no problem with the
tooltips when I use CEdit control, The tooltip is shown, however,
when
I switch to the derived class (describved in the previous post), the
nessage is not handled properly. This is the main problem. In
general
I know how to implament tooltips.
I am rather having probs wiht the message, when the mouse pointer is
dragged for the first time over the control, not permanently when it
is moved.
Thanks for suggestions
This is the main problem, when I set a breakpoint in this function it
is never hit for the derived class.
this is the implementation:
BOOL CDerivedEdit::OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT
*pResult)
{
TOOLTIPTEXT *pText = (TOOLTIPTEXT *)pNMHDR;
int Id = ::GetDlgCtrlID((HWND)pNMHDR->idFrom);
if(Id)
{
if(!GetDlgItem(Id)->IsWindowEnabled())
return FALSE;
pText->lpszText = MAKEINTRESOURCE(Id);
pText->hinst = AfxGetInstanceHandle();
return TRUE;
}
return FALSE;
}- Hide quoted text -
- Show quoted text -
Hi,
Thanks for answer.
Sorry, but I think you are a little bit confused, this is probably due
to my error.
I have got a dalog with two buttons: CEdit and CDerivedEdit.
CDerivedEdit derives of CEdit publicly and has the following
structure:
class CDerivedEdit : public CEdit
{
DECLARE_DYNAMIC(CColourEdit)
public:
static eRGBColour GoodColour;
static eRGBColour WrongColour;
CColourEdit();
virtual ~CColourEdit();
void SetBkColor(COLORREF crColor);
void SetTextColor(COLORREF crColor);
BOOL SetReadOnly(BOOL flag = TRUE);
COLORREF GetBkColor() const;
COLORREF GetTextColor() const;
void MarkAsGood();
void MarkAsWrong();
void AdjustColor(double dval);
protected:
CBrush m_brBkgnd; // Holds Brush Color for the Edit Box
COLORREF m_crBkColor; // Holds the Background Color for the Text
COLORREF m_crTextColor; // Holds the Color for the Text
public:
HWND m_ParentHandle;
virtual BOOL PreTranslateMessage(MSG* pMsg);
afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
DECLARE_MESSAGE_MAP()
};
so there is no OnToolTipNotify on this control.
On the other hand the dialog, which has got these two edits has got
(similar to MSDN) the following message map
ON_NOTIFY_EX( TTN_NEEDTEXT, 0, OnToolTipNotify)
and OnToolTipNotify is implemented as follows:
BOOL COptionPricingFooterForm::OnToolTipNotify( UINT id, NMHDR *
pNMHDR, LRESULT * pResult )
{
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
UINT nID =pNMHDR->idFrom;
if (pTTT->uFlags & TTF_IDISHWND)
{
// idFrom is actually the HWND of the tool
nID = ::GetDlgCtrlID((HWND)nID);
if(nID)
{
pTTT->lpszText = MAKEINTRESOURCE(nID);
pTTT->hinst = AfxGetResourceHandle();
return(TRUE);
}
}
return(FALSE);
}
and declared in the class as
afx_msg BOOL OnToolTipNotify(UINT id, NMHDR *pNMH, LRESULT *pResult);
Obviously I call EnableTooltips(TRUE) in OnInitDialog. The edit
assosiated with CEdit shows tooltip and the edit assosiated with
CDerivedEdit does not. Both obviously have an entry in the string
table. Now, when I change the second edit to be CEdit it shows the
tooltip, this indicates something is missing in the impleentation of
CDerivedEdit.
Could someone tell me what? Has anyone seen an app which has a derived
CEdit showing a tooltip or perhapds it is not possible? I think it
should be.
Thanks a lot for any kind of help,
Pshemek