Hi,
I need to show a custom tooltip window when mouse pointer hovers over the tray icon.
This is how I implement this functionality.
void MyTaskBarIcon::OnMouseMove(wxTaskBarIconEvent& WXUNUSED(event))
{
if (!m_bTrackMouse)
{
m_bTrackMouse = true;
wxPoint ptMouse = wxGetMousePosition();
int dpi = (int)getWinDPIMultiple();
m_rectIcon.x = ptMouse.x - 25 * dpi;
m_rectIcon.y = ptMouse.y - 25 * dpi;
m_rectIcon.width = 50 * dpi;
m_rectIcon.height = 50 * dpi;
m_timer.Start(1000);
m_pMainDlg->ShowToolTipDlg(ptMouse);
}
}
void MyTaskBarIcon::OnTrackMouse(wxTimerEvent& WXUNUSED(event))
{
wxPoint ptMouse = wxGetMousePosition();
if (!m_rectIcon.Contains(ptMouse))
{
if (m_bTrackMouse)
{
m_bTrackMouse = false;
m_timer.Stop();
m_pMainDlg->HideToolTipDlg();
}
}
}
But when some new icon is created in the system tray, a wxEVT_TASKBAR_MOVE message would be sent, so my custom tooltip window would be shown unexpectedly. Is there any way to prevent this from happening? Thanks!
Leo