This question is related to this .
In the derived CDockablePane class, I have a CTreeCtrl member for which I add ToolTip to OnCreate ():
int CMyPane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
const DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
TVS_CHECKBOXES | TVS_DISABLEDRAGDROP | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT |
TVS_INFOTIP | TVS_NOHSCROLL | TVS_SHOWSELALWAYS;
if(!m_tree.Create(dwStyle, m_treeRect, this, TREECTRL_ID) ) { return -1; }
m_pToolTip->AddTool(&m_tree, LPSTR_TEXTCALLBACK, &m_treeRect, TREECTRL_ID);
m_tree.SetToolTips(m_pToolTip);
return 0;
}
I need to call AddTool () with all optional parameters, because the default values will not work with CDockablePane.
m_treeRectis a member CRectestablished (0, 0, 10000, 10000)in CTor. This is really ugly.
I would like to adjust the rectangle of the tool whenever the size changes m_tree.
So I tried some things in CMyPane::OnSize(), but none of them worked:
- Call
m_pToolTip->GetToolInfo()then change CToolInforect element then callSetToolInfo() - Call
m_pToolTip->SetToolRect()
How should this be done?