| |
|

ActiveReports for .NET 3.0 Support
Started by pocketme at 08-02-2008 8:38 AM. Topic has 9 replies.
 
 
 
|
|
Sort Posts:
|
|
|
|
08-02-2008, 8:38 AM
|
pocketme
Joined on 07-24-2008
Posts 16
|
How to catch event of current page change in viewer
|
|
|
|
|
Hi, In the Viewer, how to catch event of current page change? Currently, there is no way to recognize current page has changed (e.g: going to next page by user). It's a big supprise because there are many other events like ZoomChanged, Find... supplied by the Viewer but there is no CurrentPageChanged event or something like that. I've found that, the built-in viewer's toolbar can catch this event somehow: if I change the value of Viewer.ReportViewer.CurrentPage in code, the page number textbox in built-in viewer's toolbar will be refreshed with new value properly. So is there any solution for that? In other side, I think this is not a big deal with ActiveReport developers, just add small code in set_CurrentPage() of ReportViewerObject. Will it be added into next coming version? Thank you!
|
|
|
|
|
Report
|
|
|
|
08-04-2008, 3:13 PM
|
Jon Smith - DD
Joined on 02-21-2007
Raleigh, NC
Posts 972

|
|
|
Can you provide more information on what you are attempting to accomplish with this event so I can enter a valid use case for this feature request?
Also, I have attached a sample which offers a workaround in the meantime. Basically, this sample catches ToolClick, KeyUp events to see if the action which triggered the event would cause a page change in the viewer. If it does cause a page change, the custom ViewerPageChange event is fired.
If you have any more questions, feel free to ask.
Thanks, Jon
|
|
|
|
|
Report
|
|
|
|
08-04-2008, 10:19 PM
|
pocketme
Joined on 07-24-2008
Posts 16
|
Re: How to catch event of current page change in viewer
|
|
|
|
|
Hi, Thanks for your response. Ok, I've tried to make my custom preview form class using my toolstrip instead of built-in toolbar. Why? It's absolutely not for fun. I know built-in toolbar can be modified via Tools collection but my application is using owner-draw toolstrips based on theme settings of application. If using ActiveReport toolbar of viewer, it will be displayed with different style. So it's great if I have a consistent UI system. Thank for your attached sample, but if built-in toolbar is visible, catching event of page change wont be necessary anymore :) By the way, there are many actions cause page's change in viewer (not only click previous/next page buttons), e.g: click mouse on page in multiple page view and continuous scroll view.... I'm still supprise why viewer has not the PageChanged event officially, without the event like that, what are ZoomChanged, Find, TableOfContent_ events for? Thanks, Hai
|
|
|
|
|
Report
|
|
|
|
08-05-2008, 10:47 AM
|
Jon Smith - DD
Joined on 02-21-2007
Raleigh, NC
Posts 972

|
Re: How to catch event of current page change in viewer
|
|
|
|
|
Thanks for your input. I have increased the priority of Case 22619 and have added this forum post to the notes for the Product Manager and Team to look over.
With the workaround, if you noticed any other events which may trigger a page change, you should be able to add additional logic to the sample in order to catch those actions and raise the custom ViewerPageChange event.
Again, the workaround is provided as a building block for a solution until we can implement this feature.
If you have any more questions, feel free to ask.
Thanks, Jon
|
|
|
|
|
Report
|
|
|
|
08-05-2008, 11:32 AM
|
Jon Smith - DD
Joined on 02-21-2007
Raleigh, NC
Posts 972

|
|
|
Another update here.
Instead of capturing all of the events which may cause a page change, it makes much more sense to capture the TextChanged event for a control which we already update for every page change. In this case, we just attach an event handler to the TextChanged event of the page number edit textbox.
Check out the attached sample, which also works with Continuous Scroll mode and Multiple Page View mode.
Note: You will need to look at the output window since I removed the annoying message boxes when testing.
-Jon
|
|
|
|
|
Report
|
|
|
|
08-05-2008, 9:42 PM
|
pocketme
Joined on 07-24-2008
Posts 16
|
Re: How to catch event of current page change in viewer
|
|
|
|
|
Hi, That trick works like a charm. Thank you very much. Still waiting for next release of ActiveReport. Hai
|
|
|
|
|
Report
|
|
|
|
01-23-2010, 2:49 PM
|
bvanderw
Joined on 01-17-2010
Posts 2
|
Re: How to catch event of current page change in viewer
|
|
|
|
|
The supplied sample program no longer works in version 6. The line:
((PlaceHolder)viewer.Toolbar.Tools[18]).Control.TextChanged += OnPageTextBoxTextChanged;
generates an exception:
"Unable to cast object of type '#is.#rs' to type 'DataDynamics.ActiveReports.Toolbar.PlaceHolder'."
Can you please provide another solution for catching current page changes?
Bruce
|
|
|
|
|
Report
|
|
|
|
01-24-2010, 2:31 AM
|
Sergey
Joined on 08-28-2004
Novosibirsk, Russia
Posts 3,017

|
Re: How to catch event of current page change in viewer
|
|
|
|
|
Hello, In ActiveReports6 the implementation of viewer toolbar was modified towards using .NET toolstrip API. Therefore, the control which shows the page number/page count is not PlaceHolder and the code causes the exception. I can provide the solution to catch the event when the current page changes. However, this feature is not supported. It
was not designed, specified, implemented, tested, documented and
shipped as the regular product feature. It can change in further versions. You can use it at your own
risk. So, the following code can be used in ViewerForm constructor in "PageChangeSample" which was sent in this thread: Tool pageEditTool = viewer.Toolbar.Tools[18]; BindingFlags internalPropertiesBindingFlags = BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty; PropertyInfo internalImpPointer = pageEditTool.GetType().GetProperty("ToolStripItem", internalPropertiesBindingFlags); ToolStripItem tsi = internalImpPointer.GetValue(pageEditTool, new object[0]) as ToolStripItem; ToolStripTextBox tsTxt = tsi as ToolStripTextBox; tsTxt.TextChanged += OnPageTextBoxTextChanged;
Sergey Abakumoff GrapeCity
|
|
|
|
|
Report
|
|
|
|
01-26-2010, 3:14 PM
|
bvanderw
Joined on 01-17-2010
Posts 2
|
Re: How to catch event of current page change in viewer
|
|
|
|
|
Sergey,
Yes, that works great.
Thanks!
|
|
|
|
|
Report
|
|
|
|
01-26-2010, 9:52 PM
|
Sergey
Joined on 08-28-2004
Novosibirsk, Russia
Posts 3,017

|
Re: How to catch event of current page change in viewer
|
|
|
|
|
|
|
|
|
GrapeCity » Product Support » ActiveReports f... » How to catch event of current page change in viewer
|
|
|
|
|