Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Markup Hyperlink and Report Control
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Markup Hyperlink and Report Control

 Post Reply Post Reply
Author
Message
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post Topic: Markup Hyperlink and Report Control
    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?
Back to Top
zitz View Drop Down
Senior Member
Senior Member


Joined: 05 October 2008
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote zitz Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 01 August 2009 at 2:19pm
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);

}

}

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

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 07 August 2009 at 9:37pm

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); } }

Back to Top
acwest View Drop Down
Groupie
Groupie


Joined: 23 April 2010
Location: Canada
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote acwest Quote  Post ReplyReply Direct Link To This Post Posted: 01 June 2010 at 11:18am
Originally posted by mdoubson 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.
Back to Top
acwest View Drop Down
Groupie
Groupie


Joined: 23 April 2010
Location: Canada
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote acwest Quote  Post ReplyReply Direct Link To This Post 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...
Back to Top
acwest View Drop Down
Groupie
Groupie


Joined: 23 April 2010
Location: Canada
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote acwest Quote  Post ReplyReply Direct Link To This Post 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
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.172 seconds.