| Markup Hyperlink and Report Control
 
 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=14423
 Printed Date: 31 October 2025 at 7:14pm
 Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
 
 
 Topic: Markup Hyperlink and Report Control
 Posted By: zitz
 Subject: Markup Hyperlink and Report Control
 Date Posted: 01 June 2009 at 12:13am
 
 
        
          | I use Xtreme ToolkitPro v13.0.0. How add Markup Hyperlink to Report control? I add CXTPReportRecordItem, and set Murkup Text to it. How can i get OnHyperlinkClick( CXTPMarkupObject* pSender, CXTPMarkupRoutedEventArgs* pArgs );
 
 | pMarkupContext->AddHandler( CXTPMarkupHyperlink::m_pClickEvent,
 CreateMarkupClassDelegate( this, &CReportCtrlComm::OnHyperlinkClick ) );
 
 | 
 What next?
 
 |  
 
 Replies:
 Posted By: zitz
 Date Posted: 01 August 2009 at 2:04pm
 
 
        
          | Please add support for Markup Hyperlink to Report control, embedded links (CXTPReportHyperlink) is very poor. Or add multiline hyperlinks to CXTPReportHyperlink ( several CRect m_rcHyperSpot1, CRect m_rcHyperSpot2... )
 
 
 -------------
 Xtreme ToolkitPro v13.1.0, static, VC++6
 |  
 Posted By: mdoubson
 Date Posted: 01 August 2009 at 2:19pm
 
 
        
          | Use 13.1 Upgrade - 
voidCXTPReportRecordItem::OnDrawCaption(XTP_REPORTRECORDITEM_DRAWARGS* pDrawArgs, XTP_REPORTRECORDITEM_METRICS* pMetrics){ ASSERT(pDrawArgs->pItem == this); CXTPReportPaintManager* pPaintManager = pDrawArgs->pControl->GetPaintManager(); BOOL bForceMarkUp(FALSE);if (pPaintManager) bForceMarkUp = pPaintManager->m_bForceDynamicMarkupForCell;
// SPECIAL Flag to use
if ((pDrawArgs->pControl->IsVirtualMode() || bForceMarkUp) && pDrawArgs->pControl->GetMarkupContext() && !m_pMarkupUIElement) { CXTPMarkupUIElement* pMarkupUIElement = XTPMarkupParseText(pDrawArgs->pControl->GetMarkupContext(), pMetrics->strText);if (pMarkupUIElement) { CRect rcItem = pDrawArgs->rcItem; rcItem.DeflateRect(2, 1, 2, 0); XTPMarkupSetDefaultFont(XTPMarkupElementContext(pMarkupUIElement), (HFONT)pMetrics->pFont->GetSafeHandle(), pMetrics->clrForeground); XTPMarkupMeasureElement(pMarkupUIElement, rcItem.Width(), INT_MAX); XTPMarkupRenderElement(pMarkupUIElement, pDrawArgs->pDC->GetSafeHdc(), &rcItem); XTPMarkupReleaseElement(pMarkupUIElement);return; } }if (m_pMarkupUIElement) { CRect rcItem = pDrawArgs->rcItem; rcItem.DeflateRect(2, 1, 2, 0); XTPMarkupSetDefaultFont(XTPMarkupElementContext(m_pMarkupUIElement), (HFONT)pMetrics->pFont->GetSafeHandle(), pMetrics->clrForeground); XTPMarkupMeasureElement(m_pMarkupUIElement, rcItem.Width(), INT_MAX); XTPMarkupRenderElement(m_pMarkupUIElement, pDrawArgs->pDC->GetSafeHdc(), &rcItem); }else {if (pPaintManager) pPaintManager->DrawItemCaption(pDrawArgs, pMetrics); } } 
 -------------
 Mark Doubson, Ph.D.
 |  
 Posted By: mdoubson
 Date Posted: 07 August 2009 at 9:37pm
 
 
        
          | You can USE hyperlink if add properly support on your app level - e.g. 
voidCReportSampleView::OnReportHyperlinkClick(NMHDR * pNotifyStruct, LRESULT * /*result*/) { XTP_NM_REPORTRECORDITEM* pItemNotify = (XTP_NM_REPORTRECORDITEM*) pNotifyStruct;if (!pItemNotify->pRow || !pItemNotify->pColumn) return;
if (pItemNotify->nHyperlink >= 0) { ::ShellExecute(NULL, _T("open"), pItemNotify->pItem->GetCaption(pItemNotify->pColumn), NULL, NULL, SW_SHOWNORMAL); //like this - ::ShellExecute(NULL, _T("open"), _T("www.google.com"), NULL, NULL, SW_SHOWNORMAL); } } 
 -------------
 Mark Doubson, Ph.D.
 |  
 Posted By: acwest
 Date Posted: 01 June 2010 at 11:18am
 
 
        
          | |  mdoubson wrote: 
 
 You can USE hyperlink if add properly support on your app level - e.g. 
void CReportSampleView::OnReportHyperlinkClick(NMHDR * pNotifyStruct, LRESULT * /*result*/) { XTP_NM_REPORTRECORDITEM* pItemNotify = (XTP_NM_REPORTRECORDITEM*) pNotifyStruct; if (!pItemNotify->pRow || !pItemNotify->pColumn) return; if (pItemNotify->nHyperlink >= 0) { ::ShellExecute(NULL, _T("open"), pItemNotify->pItem->GetCaption(pItemNotify->pColumn), NULL, NULL, SW_SHOWNORMAL); //like this - ::ShellExecute(NULL, _T("open"), _T("www.google.com"), NULL, NULL, SW_SHOWNORMAL); } } | 
 Is this answer related to your previous one? Do we need to modify the OnDrawCaption code, and how do I add the OnReportHyperlinkClick handler? I was looking into using the CXTPReportHyperlink class, but it appears to be incompatible with using XAML markup in the control.
 
 |  
 Posted By: acwest
 Date Posted: 14 June 2010 at 1:45pm
 
 
        
          | I figured out how to get hyperlinks working, using EnableMarkup, and AddHandler. The problem I have now is that when a link is displayed in the first line of the viewable area (sometimes the second line as well) the event dispatching code doesn't recognize it as being a hyperlink. If I scroll it down a line, it works fine... |  
 Posted By: acwest
 Date Posted: 15 June 2010 at 5:39pm
 
 
        
          | I did some tracing into the code, and in CXTPMarkupContext::OnWndMsg there is a test for m_pActiveElement && m_pActiveElement != pUIElement, which the link in question is failing. I'm working on figuring out why the MarkupContext thinks the mouse is in a different element than it is actually in now. -Craig
 
 |  
 
 |