Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Metrics Markup & BeforeDrawRow
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Metrics Markup & BeforeDrawRow

 Post Reply Post Reply
Author
Message
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Topic: Metrics Markup & BeforeDrawRow
    Posted: 12 July 2009 at 12:46pm
Here's what I would like to be able to do:

1) Have the user type plain text into the ReportControl cells to modify data (no problem), including the Preview area (again, no problem).
2) After user has finished editing, I want to dynamically add markup to the plaintext for display using the BeforeDrawRow event and Metrics object (problem - Markup doesn't display using Metrics.Text).
3) When the user attempts to edit a cell that has had dynamic markup applied, the Inplace Edit window should show the original plain text as entered (not the dynamic markup!) and then the dynamic markup should be reapplied for display purposes only in the BeforeDrawRow event when plain text editing is complete (problem - the Metrics.Text property seems to affect the underlying ReportRecordItem.Value/Caption property).

The problem is that changing the Metrics.Text property doesn't seem to show markup (even though there has been some discussion about this working in the past, and possibly having been fixed for 13.1 - see: https://forum.codejock.com/forum_posts.asp?TID=13599 ), and more disconcertingly, changing the Metrics.Text property seems to affect the underlying Item.Caption and Item.Value properties even though the documentation states that changing Metrics item properties does not affect the original values of the ReportRecordItem.

Quote
ReportRecordItemMetrics Object
This is used for dynamic metrics only.  This object is used to group together and store the general drawing metrics of a ReportRecordItem, such as the forecolor, backcolor, font, and text of each ReportRecordItem.  Dynamic metrics means that value set for the forecolor, backcolor, font, and text of each ReportRecordItem does not effect the original values of the ReportRecordItem.


Has anybody got this to work, or is it not possible?

Here's my attempt so far if anyone has any comments on where I am going wrong:

uploads/20090712_124246_RcDynamicMarkup.zip

Thanks in advance for any help.
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

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: 13 July 2009 at 4:54pm

Try to use Item.Caption instead of Metrics.Text

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

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 13 July 2009 at 5:16pm
The problems with using Item.Caption are:

1) The markup is not dynamic at display time only, so the underlying caption gets changed. This means when the user edits the cell it displays the Markup text in full, instead of just plain text (maybe there should be an option to use the Value property for edit cell instead of the Caption?).
2) There is no Value property for the PreviewItem, so any attempts to append markup to the preview item caption in BeforeDrawRow continually adds to the existing Markup.

Changing the Metrics.Text to Item.Caption in the BeforeDrawRow event in my sample will illustrate these issues.

I guess it's not possible now, but it would be a great feature if we could have dynamic draw-time only markup of item values of plain text. So the user never needs to see markup when editing cells, and we can algorithmically format their plain-text with markup after they have finished editing cells. This would also ensure that markup doesn't affect sorting and grouping since sorting and grouping would always be based on the plain-text entered values.

For example:

1) User types Green into cell and finishes editing.
2) BeforeDrawRow event fires, Item.Value property contains string "Green"
3) We set Metrics.Text (or some other dynamic only property, Metrics.Text just seems to be the obvious choice since it should be modifying the underlying caption/value) to "<TextBlock Foreground='" & Item.Value & "'><Bold>" & Item.Value & "</Bold></TextBlock>" and the report cell now displays Green.
4) User edits the cell again and only the plain-text Green appears in the in-place edit window. They change the edit text to Blue, and finish editing. Now the report cell displays Blue.

Obviously this is just a simplified example without value validation/escaping, but it illustrates the basic goal that I am trying to achieve.
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

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: 13 July 2009 at 5:19pm

We already had this feature between 13.0 and official 13.1 where Oleg (who supports Markup) decided that this is proper way from efficiency point of view - use a parser for each subitem is too expenisive. He is right

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

Joined: 12 January 2007
Status: Offline
Points: 1354
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 13 July 2009 at 5:58pm
Well, I think it would be a very useful feature to have dynamic display-only markup while allowing for plain-text user edits, so let me think out loud about some possible ways to make it possible *without* being too expensive:

  1) Would having it as described work only while in Virtual mode be any help? This way there is a limited number of cells that have to be redrawn with markup (unless of course the BeforeDrawRow event limits itself to visible cells anyway, in which case there would be no benefit).

  2) What about going about it from the other end - Use Item.Caption for markup as you suggested, but then have an option for the in-place edit window to display the Item.Value property instead of the Item.Caption so that the plain-text is always what appears when the user is editing cells? The PreviewItem would also require a Value property in this case (which is currently omitted). Since the markup is already handled in this case and the edit window text is the only problem, this might be the best and easiest to implement option.


Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

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

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 14 July 2009 at 4:31am
Originally posted by mdoubson mdoubson wrote:

We already had this feature between 13.0 and official 13.1 where Oleg (who supports Markup) decided that this is proper way from efficiency point of view - use a parser for each subitem is too expenisive. He is right

 
Hi,
 
You are kidding, right? How can you say that? You said you fixed this and would be in V13.1 , See post http://forum.codejock.com/forum_posts.asp?TID=13599 and now it doesn't? 
 
 
What is efficiency in: "Oleg (who supports Markup) decided that this is proper way from efficiency point of view" ?  (write: efficiency read: convenient ???)
 
 
And to Oleg: Step up to the plate and define: proper way from efficiency point of view.
 
 
Markup for Metrics.Text is far out THE best implementation of Markup in ReportControl you ever did (Well in this case Andrei) just adding records with plain text and do magical stuff in BeforeDrawRow event. Strange that this worked (without any problems) in V12.1 and now, suddenly, it doesn't anymore (oh yeah, it wasn't efficient enough), major disappointment if this is CJ's way of implementing... I put alot of effort in creating test projects and discussions with you (and discussing issues with you, is already major task) and you also told me that it has been fixed for next release (to keep us quiet for while???) 
 
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....
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: 14 July 2009 at 11:08am

ReportRecordItem::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
 // FIXED BACK! Only for virtual mode! Developer have to set Caption of Item to have markup

 if (pDrawArgs->pControl->IsVirtualMode() && pDrawArgs->pControl->GetMarkupContext() && !m_pMarkupUIElement)
 

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: 19 July 2009 at 11:14am
OK, guys - I put markup in cell work back as was fixed but with extra flag

ReportControl.PaintManager.ForceDynamicMarkupForCell = True - to use Metric.Text and

ReportControl.PaintManager.ForceDynamicMarkupForCell = False  - to use Item.Caption
 
There is a problem in Markup component - it can't support markup inside markup so if you already have markup in caption and also apply extra markup in Metric.Text - it will not work. Choose 1st or 2nd way. Or you can try dynamically switch mode in OnBeforeDraw according your own logic
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.125 seconds.