This question is related to this one.
In a CDockablePane derived class I have a CTreeCtrl member for which I add a ToolTip in 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 have to call AddTool() with all of the optional parameters because the default values won't work with CDockablePane.
m_treeRect
is a CRect
member set to (0, 0, 10000, 10000)
in the CTor. This is really ugly.
I would like to adjust the tool's rectangle whenever m_tree
's size changes.
So I tried some stuff in CMyPane::OnSize()
but none of it worked:
- Calling
m_pToolTip->GetToolInfo()
then modify theCToolInfo
's rect member, then callingSetToolInfo()
- Calling
m_pToolTip->SetToolRect()
How is it meant to be done?