Exception in Refresh()-Method

Discussions about document viewing.
Post Reply
DBr
Posts: 21
Joined: Thu Dec 09, 2010 8:21 pm

Exception in Refresh()-Method

Post by DBr » Mon Dec 13, 2010 7:38 pm

Hi, i encountered another problem.

It might be a little bit complex to describe the complete project, it is quite big. I hope the following description is sufficient.
I received an exception during a gdViewer.Refresh() call with the notice "division by 0". After some searching I noticed that pageWidth, pageHeight, verticalResolution and horizontalResolution had the values 0 or 0.0 but the currentPage is set to 1.

I'm a bit confused because these properties are read-only, so it can't be directly my fault ^^ Any ideas how these properties can become 0? Or can there be another known reason for a "division by 0" exception in a refresh call?

Thanks for the help,
Greetings

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Exception in Refresh()-Method

Post by Loïc » Tue Dec 14, 2010 1:19 pm

Hi,

Unfortunately the information are not sufficient to reproduce the problem.

Please try to give us more information, the best should be a procedure to reproduce the issue...

Kind regards,

Loïc

DBr
Posts: 21
Joined: Thu Dec 09, 2010 8:21 pm

Re: Exception in Refresh()-Method

Post by DBr » Wed Dec 15, 2010 12:17 am

Hi.
The problem is solved. I can't give a code sample now (maybe later if someone wants it) because I would have to create a new test project. As I said, it is a quite big project. I use Visual Studio and used the properties/event tab to create the gdViewer_PageChanged Method. And I found out, that this method (after calling gdViewer.DisplayImageFromFile() ) seems to be called already before the loading process is finished. Inside the event method for PageChanged some methods are called that already handle all the actions that had to be done for the pageChanged event, also drawing regions on the document.

As i said, the properties for resolution and size are 0 during this process which I think caused the exception. The properties are only set after all event handling is done and the programm code jumps back to the point where DisplayImageFromFile() was called. After that line the size and resolution properties are not 0.

I solved the problem by removing the event method from the viewer and call it myself right behind the display method. Now it works fine. I hope I was able to eplain what happened. If not or if someone is interested a code example, I can try to build up a small project to reconstruct the error.

But thanks anyway ;-)

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Exception in Refresh()-Method

Post by Loïc » Wed Dec 15, 2010 12:46 pm

Thank you very much for the return and your kind proposition.

I will try to reproduce the problem again. Maybe our current 7.3 version (to be released very soon) already solve the issue.

Cheers,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests