[BUG] Metrics for Report Item doesn't show markup |
Post Reply |
Author | |
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
Posted: 06 March 2009 at 10:35am |
Hi,
Topic description says it all
I don't understand... In V12.1 this worked (and I didn't use it) and now I want to use markup in ReportItems (yes just this once) and now it doesn't work. I thought this was an OK version but it isn't.
In V12.1 this works OK:
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
I checked our VB Report Sample and this code properly works -
'Execute this code to apply predefined formatting. To turn on automatic formatting, select it from the menu
If (mnuAutomaticFormating.Checked) Then 'Replace the backgroung color of every other row If ((Row.Index Mod 2 = 0) And (Row.GroupRow = False)) Then 'This will dynamically change the BackColor of the ReportRecordItem, this value 'is not saved in the Item.Backcolor property. Once mnuAutomaticFormating.Checked is false, 'the original backcolor is restored because this code is not executed Metrics.BackColor = RGB(245, 245, 245) End If 'Change the text color of items that have the word "Undeliverable" in them If (Item.Index = COLUMN_SUBJECT) Then If (InStr(1, Item.Value, "Undeliverable", vbTextCompare)) Then 'This will dynamically change the text color of the ReportRecordItem, this value 'is not saved in the Item.ForeColor property. Once mnuAutomaticFormating.Checked is false, 'the original text color is restored because this code is not executed Metrics.ForeColor = vbRed End If End If 'Apply fntStrike to the text of all items in a record that have a group caption of "Date: This Year" If (Row.Record(10).GroupCaption = "Date: This Year" And Item.Index <> -1) Then 'This will dynamically change the font of the ReportRecordItem, this value 'is not saved in the wndReportControl.PaintManager.TextFont property. Once mnuAutomaticFormating.Checked is false, 'the original font is restored because this code is not executed Metrics.Font.Strikethrough = True End If End If This is not markup but this is custom draw support. I don't remember markup sample except group row-related
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi Mark,
I didn't say there was something wrong with metrics, ONLY MARKUP !!!
Just add the line of code in DrawBeforeRow event in version:
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
You not right - it works, e.g.
CString cstrMarkupShortSample(_T( "<StackPanel VerticalAlignment='Top' HorizontalAlignment='Center'><TextBlock><Bold>Subject:</Bold> </Italic> <Run Foreground='Red'>2009</Run> Released!</TextBlock></StackPanel>"));GetReportCtrl().GetColumns()->GetAt(COLUMN_SUBJECT)->SetCaption(cstrMarkupShortSample); GetReportCtrl().GetRecords()->GetAt(9)->GetItem(COLUMN_SUBJECT)->SetCaption(cstrMarkupShortSample); GetReportCtrl().GetRecords()->GetAt(9)->GetItemPreview()->SetCaption(cstrMarkupLongSample); GetReportCtrl().RedrawControl(); } check item with text SuitPro 2009 - year colored by markup!
Port piece on VB :
Private Sub wndReportControl_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)
Dim a As String
a = "<StackPanel VerticalAlignment='Top' HorizontalAlignment='Center'><TextBlock><Bold>Subject:</Bold> <Italic>SuitePro</Italic> <Run Foreground='Red'>2009</Run> Released!</TextBlock></StackPanel>" If Item.Index = 1 Then Item.Caption = a
wndReportControl.PaintManager.RefreshMetrics End If
End Sub
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
C'mon Mark, Metrics.Text should accept markup string and not the way you are doing this
Now here is test project and this is how it should work and not in a way you explained in previous reply.
This is build with V12.1.0 OCX
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Sorry you always know how it SHOULD work and ignore when I show you HOW TO USE the feature. Wrong (obsolete) documention is not a reason of reporting bug but reason asking to fix the documentation
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi Mark,
Did you pay attention Mark? The test project is NOT about showing you how it should work, only how it worked in previous version.
This has nothing to do with documentation. I (almost) never read that, only when having trouble with some things... Developers have built entire applications with V12.1 using Metrics.Text because it was implemented like that. They will be happy when upgrading to a newer version..... NOT !!! You can not change an implementation just for you own needs, NEVER !!!!.
And now you tell me I don't use it properly I don't have to change GroupCaption of grouped row (BECAUSE IT WAS IMPLEMENTED LIKE THIS !!!!!) So Metrics.Text does support markup as implemented:
So this isn't a bug?
Thanks for nothing
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
VirtualListEdit sample with markup-sample in
void CVirtualRecord::GetItemMetrics(XTP_REPORTRECORDITEM_DRAWARGS* pDrawArgs, XTP_REPORTRECORDITEM_METRICS* pItemMetrics){......
case 5:
{ CString sMarkup; sMarkup.Format(( "<TextBlock><Bold Foreground='Red'>%s</Bold></TextBlock>"), m_pSet->m_Department);pItemMetrics->strText = sMarkup; break;} ......
|
|
xiote
Newbie Joined: 12 March 2009 Status: Offline Points: 1 |
Post Options
Thanks(0)
|
it dosn't work Metrics.Text markup in V13(ActiveX)
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
void CXTPReportRecordItem::OnDrawCaption(XTP_REPORTRECORDITEM_DRAWARGS* pDrawArgs, XTP_REPORTRECORDITEM_METRICS* pMetrics){ASSERT(pDrawArgs->pItem == this); //THIS CONDITION - IsVirtualMode() [Rev 7687 Oct 2008] PREVENTS MARKUP in Non-Virtual mode //if (pDrawArgs->pControl->IsVirtualMode() && pDrawArgs->pControl->GetMarkupContext()) if (pDrawArgs->pControl->GetMarkupContext())..................................................................
FIXED NOW = be in 13.1
this sample code properly run under recompiled OCX
Private Sub wndReportControl_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)
Metrics.Text = "<TextBlock><Bold>Subject:</Bold> <Italic>SuitePro</Italic> <Run Foreground='Red'>2009</Run> Released!</TextBlock>" End Sub |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi Mark,
I'm glad you saw the
This is how it should work, if you want to do some magic stuff in BeforeDrawRow event, you shouldn't have to change caption of ReportItem, just leave original value as is and change Metrics.Text if you want to...
Thank you
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
VB Sample run
For i = 0 To 10
Set XtremeColumn = ReportControl.Columns.Add(i, "Column " & i, i * 50 + 10, True) XtremeColumn.Caption = "<TextBlock>Click <Bold Foreground='Red'>(Me)</Bold></TextBlock>" Next i ReportControl.EnableMarkup = True |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi Mark,
I know that, if you assign value to Column.Caption, it will work otherwise it doesn't. This has been always like this. (If you would add column and assign value it doesn't show markup). I have no problem with that
But I'm glad you replied on this post. I had to try again because you said you fixed Metrics.Text (with Markup) in BeforeDrawRow event. A while ago I posted a bug regarding Markup when a column is dropped into Groupbox. The "button" in GroupBox shows Markup, but the "button" width is to small :(
To reproduce:
Output:
Thanks
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Could not reproduce - repeat all your steps. If column wide is small - we can't see all markuped text in column but if you drag this column to group box - you see it totally with even extra empty pixels on right side
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi Mark,
See post https://forum.codejock.com/forum_posts.asp?TID=12601 for a test project. It was a sticky post but no one replied and after a while I let the post slide down the forum. But now you can actually do something about it
Thanks
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
It was old-version embeded project. Please update it to the way I can load it with current version.
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
I uploaded new version in that post.
Thanks
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Thanks. Now I see the problem with small column to drag. Will try to fix
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
So the problem is here:
this is a rectangle used to group item draw:
CRect rcItem(x, y, x + pColumn->GetCaptionWidth(pDC) + 50, y + nHeaderHeight - 3); and function to GetCaptionWidth is here:
int CXTPReportColumn::GetCaptionWidth(CDC* pDC) { if (m_pMarkupUIElement) {CSize szText = XTPMarkupMeasureElement(m_pMarkupUIElement, m_rcColumn.Width(), INT_MAX); return szText.cx;} return pDC->GetTextExtent(m_strName).cx;} so if XTPMarkupMeasureElement not properly calculated (and this is not a Report Control code but other component code) - we will have cutted text as we already see.
here CString m_strName; // Column name. |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi Mark,
It looks great I don't see any problems
Thanks a lot
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi Mark,
I don't know what to look for but the only thing I see is that horizontal scrollbar becomes visible when last column isn't visible anymore (during sizing of form) And sometimes (I saw this about three times) when clicking on scrollbar, the scrollbar becomes invisible but I noticed that RC is 1 pixel wider when this happens...
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi Mark,
It looks OK to me, resizing goes well with both RC's and scrollbars are visible when needed.
Good job
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
Hi Mark,
I've just tested this build as well, and everything looks perfect! Thanks a lot for all of your hard work on this issue. |
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
Sorry to drag up an old post, but I have a question about Metrics.Text
and some behaviour that I find strange (and some behaviour that I
require).
First, I want: 1) To be able to sort a report control column by a value that is different from what is displayed (easy). 2) The cell display should be automatically formatted with markup (easy) 3) The user to be able to edit a cell without any markup text appearing (apparently difficult, but maybe I am missing something). I thought that in order to accomplish this, I would: 1) Set the Value property of a ReportRecordItem to the sortable value (for example, "2010-10-10T00:00:00Z") 2) Set the Caption property to the value that the user will edit (for example, "October 10, 2010"), 3) In the BeforeDrawRow event, set the Metrics.Text property to my markup formatted string (for example "<TextBlock><Span Backcolor='Yellow'>October</Span> 10, 2010</TextBlock>" (as long as the PaintManger.ForceDynamicMarkupForCell property was True). This works in terms of sorting and displaying marked up values, but when the user tries to edit a cell, this is the result: Why does the edit cell text appear with the markup tags if I only set the Metrics.Text property in the BeforeDrawRow event? My impression was that the Metrics object was for dynamic display purposes only, and the Caption property would be used for the edit cell text (or anywhere the Metrics.Text property wasn't set). So my questions are: 1) Is this a bug? 2) If no to #1, is there a way to accomplish what I would like to do with the current ReportControl state? 3) If no to #2, can we have a way to accomplish this for the next version? Thanks for any insights and help. Also, here's a test project if required: uploads/2676/RcEditMarkup.zip |
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi Jason,
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
Hi Aaron, thanks for the reply - so I'm not crazy then ;)
By #2, I meant that I generally want to accomplish the following: 3 "values" associated with a ReportControlItem: 1) A hidden value used for sorting purposes (i.e. the Value property) 2) A value used for editing and default display purposes (i.e. the Caption property) 3) A value used for dynamic formatting (display purposes only) that over-rides the Caption value when present (the Metrics.Text property). The user should never see raw markup, so they should see the Caption property value when EditMode = True and see the Metrics.Text value (as rendered Markup if it's a markup string) when EditMode=False (or if Metrics.Text isn't set to anything in the BeforeDrawRow event, then just default the cell text to the Item.Caption value). I used dates as just a simple example for demo, but what I really need a separate value for is a custom sort string that I create that allows me to sort alpha-numeric values smartly. For example, if the user types this in 5 different cells: A10 A3 A200 A1 A2 Normal sorting rules would display in this order: A1 A10 A2 A200 A3 I have a routine which pads out internal numbers to something like this (again, example): A00010 A00003 A00200 A00001 A00002 So that when you sort the list appears as: A1 A2 A3 A10 A200 Of course, I don't want the user to see the padded out numbers, so I use the Value property for them. The user can type codes like A1, A2, etc... and they will now be sorted "correctly" but look just as they type them in the cell display and edit box. Lastly, different leading alpha characters (A, B, C, etc...) can have a different colour associated with them, so I want to use the Metrics.Text property to display the cell in a custom format. I'm not sure why the edit window for a cell is defaulting to the Metrics.Text value - I've even tried changing the Metrics.Text property to Item.Caption in the RequestEdit and BeforeDrawRow events, but I haven't had any luck getting the edit window text to appear without markup tags... I'll keep experimenting and also open a ticket. Thanks for your help, Merry Christmas! |
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
Looks like you can use SendMessage on the InplaceEditHwnd with
WM_SETTEXT to get the caption to appear without markup tags. I don't
think we should have to do this though.
Here's a demo: uploads/2676/RcEditMarkup2.zip |
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Thanks, this one is fixed.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
jpbro
Senior Member Joined: 12 January 2007 Status: Offline Points: 1355 |
Post Options
Thanks(0)
|
Beautiful! Thanks Oleg.
|
|
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3 Language: Visual Basic 6.0 SP6 |
|
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 |