Quote:
>This works if I'm
>only displaying a tooltip for the edit control, but it only works before the
>contents of the combobox change. If they do for any reason (opening the
>combobox, changing text in edit control or calling CComboBox::AddString()),
>the tooltips stop working.
Tomas,
I get the same problem too. There are some weird quirks with tooltips
for dialog controls. I find that the documentation doesn't really tell
me enough about the implementation in order to understand things well
enough to make anything other than guesses to fix the problems.
Try this too - move the mouse over the combo box drop down arrow to
show the combo box tooltip, then move the mouse over the combo box's
edit control without moving it over the dialog box. Does the tooltip
now flicker on and off repeatedly for you? The tooltip also flickers
for me on every alternate click/release of the mouse button in the
combo box's edit field.
I should add that I don't see the same problem with an equivalent SDK
implementation - with that the combo box's edit field tooltip works
consistently. There's definitely something strange with the MFC
implementation of tooltips for dialog controls.
I suggest that you create a really small simple application that
illustrates the situation and let MS know via the reporting tool on
the MS web site (somewhere). I'm also working on an example to
illustrate these issues too.
I'm still experimenting but I've just tried this and it remedies
things in my situation:
BOOL CMfcDlgttDlg::PreTranslateMessage(MSG* pMsg)
{
/* Code I've transplanted from _AfxRelayToolTipMessage (just a
guess as my SDK project is OK) */
MSG msg = *pMsg;
msg.hwnd = (HWND)m_tooltip.SendMessage(TTM_WINDOWFROMPOINT, 0,
(LPARAM)&msg.pt);
CPoint pt = pMsg->pt;
if (msg.message >= WM_MOUSEFIRST && msg.message <=
WM_MOUSELAST)
::ScreenToClient(msg.hwnd, &pt);
msg.lParam = MAKELONG(pt.x, pt.y);
// relay mouse event before deleting old tool
m_tooltip.SendMessage(TTM_RELAYEVENT, 0, (LPARAM)&msg);
// CG: The following block was added by the ToolTips
component.
{
// Let the ToolTip process this message.
// m_tooltip.RelayEvent(pMsg);
}
return CDialog::PreTranslateMessage(pMsg); // CG: This
was added by the ToolTips component.
Quote:
}
>I'm also looking into adding tooltips for strings that do not fit into the
>listbox of the combobox, Any Ideas about this?
I guess you'll need to derive your own listbox class and handle the
mouse move messages. There's an article on some aspects of tooltips in
MSJ April 1997, one it does cover is providing data tips which sounds
something like what you want.
Dave
----
Address is altered to discourage junk mail.
Remove ".---" for the real address.