Markup Hyperlink and Report Control |
Post Reply |
Author | |
zitz
Senior Member Joined: 05 October 2008 Status: Offline Points: 112 |
Post Options
Thanks(0)
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 );
What next? |
|
zitz
Senior Member Joined: 05 October 2008 Status: Offline Points: 112 |
Post Options
Thanks(0)
|
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
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Use 13.1 Upgrade -
void CXTPReportRecordItem::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); } } |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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); } } |
|
acwest
Groupie Joined: 23 April 2010 Location: Canada Status: Offline Points: 16 |
Post Options
Thanks(0)
|
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. |
|
acwest
Groupie Joined: 23 April 2010 Location: Canada Status: Offline Points: 16 |
Post Options
Thanks(0)
|
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...
|
|
acwest
Groupie Joined: 23 April 2010 Location: Canada Status: Offline Points: 16 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |