Print Page | Close Window

Record item tooltip with Caption + Description?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=16345
Printed Date: 16 June 2024 at 11:37am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Record item tooltip with Caption + Description?
Posted By: znakeeye
Subject: Record item tooltip with Caption + Description?
Date 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/



Replies:
Posted By: adrien
Date 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.

-------------
http://www.wingate.com - http://www.wingate.com


Posted By: znakeeye
Date Posted: 03 March 2010 at 5:24pm
I guess I have to override MyItem::OnToolHitTest. Thanks.

-------------
PokerMemento - http://www.pokermemento.com/


Posted By: znakeeye
Date 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/


Posted By: adrien
Date 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)

-------------
http://www.wingate.com - http://www.wingate.com


Posted By: adrien
Date 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;
}


-------------
http://www.wingate.com - http://www.wingate.com


Posted By: znakeeye
Date 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/


Posted By: adrien
Date 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.



-------------
http://www.wingate.com - http://www.wingate.com


Posted By: znakeeye
Date Posted: 06 March 2010 at 6:16pm
I agree.

-------------
PokerMemento - http://www.pokermemento.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net