Two points further to this post:
1. I made a mistake in the original post, and cut and pasted the wrong code.
Handling WM_XTP_CONTROLSELECTED works (almost - see point 2 below) with CXTPControl::SetTooltip() _when called from CMainFrame_ to update the tooltip on the application main menu (or a submenu thereof).
But it does not work when called to update a Context right-click popup menu invoked with TrackPopupMenu() from a view. In that case, I get my trace, but no tooltip. In other words, the following code is invoked, but puts no toolitp on the context menu:
LRESULT CMyView::OnXTPControlSelected(WPARAM wParam, LPARAM lParam)
{
CXTPControl * ctrl = (CXTPControl *)wParam;
if(!ctrl) return NULL;
CString msg;
msg.Format("id=%d\n", ctrl->GetID());
TRACE(msg);
ctrl->SetTooltip(msg);
return lParam;
}
Is there a way to get dynamic tool tips on a context menu?
2. Even when called from CMainFrame to update the application menu menu, the WM_XTP_CONTROLSELECTED message gets there late. (There is a forum post of 16 December 2009 on this, but no followup). WM_XTP_CONTROLSELECTED gets handled _after_ the tooltip is displayed, so the first tooltip the user sees is the _second last_ tooltip set with CXTPControl::SetTooltip().
Is there a way around this? Either another message (WM_XTP_CONTROL_ABOUT_TO_BE_SELECTED?), or a way of intercepting something like WM_XTP_INITMENU, so that a current and up to date tooltip can be provided?
I'm sure that more than one developer has wrestled with this.
Thanks for any input,
Mark Proudman
mailto:mfproudman@gmail - mfproudman@gmail
------------- Mark Proudman
|