Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Record item tooltip with Caption + Description?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Record item tooltip with Caption + Description?

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: Record item tooltip with Caption + Description?
    Posted: 03 March 2010 at 1:39pm
And an icon!
 
Is it possible? I keep getting simple tooltips with the text only, even though m_bShowTitleAndDescription is set to true...
 
XTP 13.3.0.
PokerMemento - http://www.pokermemento.com/
Back to Top
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post Posted: 03 March 2010 at 5:04pm
how do you fill the item out? There are 2 prototypes for

CXTPToolTipContext::FillInToolInfo

which you call from within your OnToolHitTest function.

(neither of which seem to be in the documentation BTW). The second one takes 3 strings, tooltip (leave empty), title and description.
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 03 March 2010 at 5:24pm
I guess I have to override MyItem::OnToolHitTest. Thanks.
PokerMemento - http://www.pokermemento.com/
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 03 March 2010 at 6:26pm

This is rather hacky! Is there another way?

 
INT_PTR CMyRecordItem::OnToolHitTest(CPoint /*point*/, TOOLINFO* pTI)
{
    CXTPReportRow *pRow = m_pControl->GetRows()->GetAt(GetIndex()); // Not sure if this is even correct!
    CRect rcItem = pRow->GetItemRect(this);
    INT_PTR nHit = ID_MY_ICON;
    CXTPToolTipContext::FillInToolInfo(pTI, m_pControl->m_hWnd, rcItem, nHit, GetTooltip(), m_strTooltipText, m_strDescription, XTPImageManager());
   
    return nHit;
}
PokerMemento - http://www.pokermemento.com/
Back to Top
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post Posted: 03 March 2010 at 9:48pm
ah.. from a report control?

don't know sorry!

That way is how I do it in my own custom controls (CWnd-derived)
Back to Top
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post Posted: 03 March 2010 at 9:50pm
yeah, looks like CJ code won't support title and description no matter what...

INT_PTR CXTPReportRow::OnToolHitTest(CPoint point, TOOLINFO* pTI)
{
     CRect rcItem;
     CXTPReportRecordItem* pItem = HitTest(point, &rcItem);

     if (!pItem)
          return -1;


     INT_PTR nHit = pItem->OnToolHitTest(point, pTI);
     if (nHit != -1)
          return nHit;

     nHit = (INT_PTR) pItem;
     CString strTip = pItem->GetTooltip();

     m_pControl->OnGetToolTipInfo(this, pItem, strTip);

     if (strTip.IsEmpty() || strTip == _T(" "))
          return -1;

     if (m_pControl->GetPaintManager()->m_bCleanTooltip)
     {
          //Clean markup
          CString s(strTip), u, v;
          int j = s.Find(_T("<"));
          int k = s.Find(_T(">"));
          while (j > -1 && k > -1)
          {
               u = s.Left(j);
               v = s.Mid(k + 1);
               s = u + v;
               strTip = s;
               j = s.Find(_T("<"));
               k = s.Find(_T(">"));
          }
     }

     CXTPToolTipContext::FillInToolInfo(pTI, m_pControl->m_hWnd, rcItem, nHit, strTip);

     return nHit;
}
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 04 March 2010 at 4:14am
Look at my code. It works, but it's ugly!
 
I hope there is a better way...
PokerMemento - http://www.pokermemento.com/
Back to Top
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post Posted: 04 March 2010 at 2:47pm
I think codejock needs to go through all their code wherever it calls CXTPToolTipContext::FillInToolInfo, and make sure it's compatible with the concept of a caption and tooltip (2 strings).

I even had to derive from CXTPButton in order to get tooltips like this without having to have text on the button face itself.

Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 06 March 2010 at 6:16pm
I agree.
PokerMemento - http://www.pokermemento.com/
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.