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

[SOLVED] Markup and refreshing

 Post Reply Post Reply
Author
Message
Aaron Koolen View Drop Down
Groupie
Groupie


Joined: 22 July 2009
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Koolen Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED] Markup and refreshing
    Posted: 29 March 2015 at 10:44pm
Hi all. I have a report control with markup enabled. There seems to be a few things I must be missing to get the control to update and display properly so I hope someone can help.

I enable markup on the control with EnableMarkup() but I also found I needed to set m_bForceDynamicMarkupForCell in the paint manager otherwise I found that after calling Populate() I had to go through each record in the control and refresh it's contents with calls to SetCaption().

I have found that if I create an item for a record and give it initial text, then the size of the cell is not calculated due to the markup, but to the contents, unparsed. So the cells end up larger than they should be. If I refresh the items manually (As above) then it recalculates.

If I dynamically update an item of a record, then the scroll bars to not adjust. If the item made the cell larger then the bottom of the report control is cut off. I have to call AdjustScrollBars() to get it to work.

All in all it seems that markup in report controls are not particularly dynamic and in some cases quite bugged. I would have expected to have just had to set the EnableMarkup(TRUE) on the control, set the markup when either creating the items with AddItem or changing them with SetCaption and have everything adjust correctly. It certainly doesn't seem to work that way.

Is there some documented set of steps to create and update markup items?

Thanks
Aaron
Product: Xtreme ToolkitPro v13.3.0 (MFC)
Platform: Windows XP (32bit) - SP 3
Language: Visual C++ 6
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 04 April 2015 at 10:26am
Hello Aaron,

Originally posted by Aaron Koolen Aaron Koolen wrote:

I enable markup on the control with EnableMarkup() but I also found I needed to set m_bForceDynamicMarkupForCell in the paint manager otherwise I found that after calling Populate() I had to go through each record in the control and refresh it's contents with calls to SetCaption().
I think showing unparsed markup in report cells it is very very special way of using ReportControl  else if you don't want show xml you must update cells with readable captions anyway.

Originally posted by Aaron Koolen Aaron Koolen wrote:

I have found that if I create an item for a record and give it initial text...
  What code do you use for this (also what version of toolkitPro) ? This behaviour really can be wrong.

Originally posted by Aaron Koolen Aaron Koolen wrote:

If I dynamically update an item of a record, then the scroll bars to not adjust. If the item made the cell larger then the bottom of the report control is cut off. I have to call AdjustScrollBars() to get it to work.
I think it is normal behaviour because ReportControl doesn't know exactly how many items do you want to update this time. It is so expensive to call AdjustScrollBars() for every item if you update 100 and more recordItems at once.

Thank you.
Regards,
  Oleksandr Lebed
Back to Top
Aaron Koolen View Drop Down
Groupie
Groupie


Joined: 22 July 2009
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Koolen Quote  Post ReplyReply Direct Link To This Post Posted: 06 April 2015 at 7:08pm
Thanks for the reply Oleksandr.



Originally posted by olebed olebed wrote:

Hello Aaron,

Originally posted by Aaron Koolen Aaron Koolen wrote:

I enable markup on the control with EnableMarkup() but I also found I needed to set m_bForceDynamicMarkupForCell in the paint manager otherwise I found that after calling Populate() I had to go through each record in the control and refresh it's contents with calls to SetCaption().
I think showing unparsed markup in report cells it is very very special way of using ReportControl  else if you don't want show xml you must update cells with readable captions anyway.

Sorry if I wasn't clear. I don't want to show unparsed markup, but that's what I was getting until I called SetCaption() after a Populate(). So I can't even go AddRecord(record), record->SetCaption(xml). I have to add all the records, call Populate() and then iterate over all the records calling SetCaption().

Originally posted by olebed olebed wrote:

Originally posted by Aaron Koolen Aaron Koolen wrote:

I have found that if I create an item for a record and give it initial text...
  What code do you use for this (also what version of toolkitPro) ? This behaviour really can be wrong.

Here's some pseudocode. Inside my MyDerivedRuleRecord constructor I go
m_filterItem = new CXTPReportRecordItemText(SomeFunctionToGetGetXML(), true);
AddItem(m_filterItem);

and in my derived report control I have
MyDerivedRuleRecord *newRecord = new MyDerivedRuleRecord();
AddRecordEx(newRecord);

Originally posted by olebed olebed wrote:


Originally posted by Aaron Koolen Aaron Koolen wrote:

If I dynamically update an item of a record, then the scroll bars to not adjust. If the item made the cell larger then the bottom of the report control is cut off. I have to call AdjustScrollBars() to get it to work.
I think it is normal behaviour because ReportControl doesn't know exactly how many items do you want to update this time. It is so expensive to call AdjustScrollBars() for every item if you update 100 and more recordItems at once.

Maybe it would be good to have this work within a BeginUpdate()/EndUpdate() system. That way you could transactionalise it or if you didn' bother, the updating would happen automatically.  We're using 16.3.1.

I think overall, if there was actual documentation on using CodeJock and not just a reference manual, many many hours of developer time could have been saved as we tend to have to go looking around source code and scouring interfaces and example code to find out the way CodeJock wants us to do things.

Thanks
Aaron
Product: Xtreme ToolkitPro v13.3.0 (MFC)
Platform: Windows XP (32bit) - SP 3
Language: Visual C++ 6
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 09 April 2015 at 10:11am
Hello Aaron,

Thank you for bringing this to our attention. I have discovered that implementation of markup in ReportControl really wasn't finished.
I have fixed issues with refreshing of markup. The fix will be available in the next beta or final release.

Therefore, from next release:
1) CXTPReportControl::EnableMarkup() works at any moment correctly and refresh markup elements of recordItems, column's headers, groupRows, scrollBars. But developer must update content of ReportRecordItems to appropriate text with ReportRecordItems::SetCaption() anyway. Oterwise users will see unparsed xml.

2) diverse initialization order supported. For example: create recordItems [markuped/plain captions can be setted there], create record and add items [or there], add record to reportControl [or there].

3) fixed: If ReportRecordItem has already markuped caption CXTPReportRecordItem::m_strCaption then there is no way to set markuped content through GetItemMetrics() and metrics->strText when pPaintManager->m_bForceDynamicMarkupForCell is TRUE or VirtualMode turned on.

So markup content can be setted also through GetItemMetrics() and metrics->strText when pPaintManager->m_bForceDynamicMarkupForCell is TRUE or VirtualMode turned on.

Note that CXTPReportPaintManager::m_bForceDynamicMarkupForCell saves memory BUT this is expensive for processor because it forces creating and destroying temporary markup objects every time when ReportRecordItems::OnDrawCaption() method. m_bForceDynamicMarkupForCell used as analog to virtual mode behaviour. Usual behaviour is creating markup objects only on SetCaption() or EnableMarkup(TRUE).

Regards,
Oleksandr Lebed
Back to Top
markr View Drop Down
Senior Member
Senior Member


Joined: 01 August 2004
Status: Offline
Points: 441
Post Options Post Options   Thanks (0) Thanks(0)   Quote markr Quote  Post ReplyReply Direct Link To This Post Posted: 16 October 2018 at 4:46pm
In some instances, we need to inject markup through GetItemMetrics() because we don't know the dimensions of the rendered cell rectangle prior to that point. This may happen whether the control is using virtual mode or not.

In such cases, I find that the BestFit() method (or double clicking on a column divider to auto-size) no longer works correctly for such columns. It appears to be resizing according to the unparsed markup (rather than the rendered markup).

Is this a bug, or am I perhaps missing something? Any thoughts on a workaround?

- Mark R.
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.