SetWindowPos has not effect on tooltip

Posted by YoungPony on Stack Overflow See other posts from Stack Overflow or by YoungPony
Published on 2010-06-10T14:43:59Z Indexed on 2010/06/10 14:52 UTC
Read the original article Hit count: 227

Filed under:
|
|
|

Hello, I am trying to give my ComboBox an in place tooltip for long strings. However when I call SetWindowPos on the tooltip, the position is never changed. Called when TTN_SHOW is received:

::SetWindowPos(textTooltip, NULL, TipRect.left, TipRect.top, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER);

If I remove the SWP_NOSIZE flag and pop in some values into the width/height, then the combo box changes size to these values but the position remains the same. SetWindowPos always returns TRUE.

The tip is initialised like so:

        textTooltip = CreateWindowEx(WS_EX_TRANSPARENT, TOOLTIPS_CLASS, NULL, TTS_NOPREFIX, 0, 0, 0, 0, this->GetSafeHwnd(), NULL, NULL, NULL);
        if(!textTooltip)
            return;

        ZeroMemory(&ToolInfo, sizeof(TOOLINFO));
        ToolInfo.cbSize = sizeof(TOOLINFO);
        ToolInfo.uFlags = TTF_TRANSPARENT | TTF_SUBCLASS; 
        ToolInfo.hwnd = this->GetSafeHwnd();
        ToolInfo.lpszText = "place holder"; //set in OnSelectChangeOk
        ToolInfo.uId = 0;   
        ToolInfo.rect = TipRect; //rect is re-set in OnSelectChangeOk

        ::SendMessage(textTooltip, TTM_ADDTOOL, 0, (LPARAM)&ToolInfo);

Am I missing something?

© Stack Overflow or respective owner

Related posts about c++

Related posts about mfc