TWAIN ActiveX Control, Plug-in, Scanner SDK, Component, HTTP Control/SDK

Dynamsoft TWAIN Products

Support Community for TWAIN Control/Component/SDK for Scanning Solutions
* Login   * Register
* FAQ    * Search

It is currently Tue May 22, 2012 1:55 am




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Problem with OnPostTransfer with IE & Ajax
PostPosted: Mon Jul 09, 2007 7:25 am 
Offline

Joined: Mon Jul 09, 2007 7:17 am
Posts: 4
Hi,

I have recently made changes to an application of ours to allow it to use AjaxPanels. Since I have made this change there has been problems getting OnPostTransfer to attach to the ActiveX object properly.

I have been using the following code to do it:

Code:
<SCRIPT language="javascript" event="OnPostTransfer" for="DynamicWebTwain1">
<!--
   UploadBatch();
//-->
</SCRIPT>


Which has worked fine until now. Now that the ActiveX control is living in an Ajax Panel the above code calls UploadBatch() only when the page loads and not when OnPostTransfer is called. This is only affecting the ActiveX control, the plugin is working correctly (using the example code on the Dynamsoft site).

Is there any other way I can attach my function to the OnPostTransfer event?

Thanks,
Andy


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 09, 2007 6:13 pm 
Offline
User avatar

Joined: Mon Mar 07, 2005 11:11 pm
Posts: 866
Do you want to call UploadBatch when the OnPostTransfer event is fired? If yes, please try the following code and see if it works fine.
Code:
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function DynamicWebTwain1_OnPostTransfer() {
   UploadBatch ();
}
//-->
</SCRIPT>

<SCRIPT LANGUAGE=javascript FOR=DynamicWebTwain1 EVENT=OnPostTransfer>
<!--
DynamicWebTwain1_OnPostTransfer();
//-->
</SCRIPT>

As this topic is about Dynamic Web TWAIN, I will move it to Dynamic Web TWAIN forum in 1 business day.

Thanks.

_________________
Robert
TWAIN Support Team
http://www.dynamsoft.com/
TWAIN ActiveX/Plug-in HTTP Control/SDK & TWAIN ActiveX Control, Scanner SDK, Component
Software Configuration Management | SCM Solution


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 11, 2007 12:59 am 
Offline

Joined: Mon Jul 09, 2007 7:17 am
Posts: 4
Oops, didn't realise I had posted it in the wrong forum, sorry :)

I tried the code snippet you posted but the same problem has occured, I think there is something in the javascript / code of the AjaxPanel that is ignoring the FOR and EVENT parameters for the SCRIPT tag and as such the DynamicWebTwain1_OnPostTransfer(); funciton is being called staight away when the page is loaded instead of attaching it to the OnPostTransfer event.

This isn't really a Dynamic Web Twain problem as such, I was just curious if there was another way of attaching a function to the OnPostTransfer event.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 11, 2007 8:49 pm 
Offline
User avatar

Joined: Mon Mar 07, 2005 11:11 pm
Posts: 866
Quote:
This isn't really a Dynamic Web Twain problem as such, I was just curious if there was another way of attaching a function to the OnPostTransfer event.
We will look into this issue. If we have any solution, we will update you.

Thanks.

_________________
Robert
TWAIN Support Team
http://www.dynamsoft.com/
TWAIN ActiveX/Plug-in HTTP Control/SDK & TWAIN ActiveX Control, Scanner SDK, Component
Software Configuration Management | SCM Solution


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 12, 2007 12:42 am 
Offline

Joined: Mon Jul 09, 2007 7:17 am
Posts: 4
I've managed to find a solution for my problem, using the following function:

Code:
    var addListener = function() {
        if ( window.addEventListener ) {
            return function(el, type, fn) {
                el.addEventListener(type, fn, false);
            };
        } else if ( window.attachEvent ) {
            return function(el, type, fn) {
                var f = function() {
                    fn.call(el, window.event);
                };
                el.attachEvent(type, f);
            };
        } else {
            return function(el, type, fn) {
                element[type] = fn;
            }
        }
    }();


I then attach the function I require using:

Code:
twain=document.getElementById("DynamicWebTwain1");
addListener(twain, 'OnPostTransfer', UploadBatch);


And this works perfectly in IE6/7. Hope this might be useful for any others who have this problem.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 12, 2007 5:41 pm 
Offline
User avatar

Joined: Mon Mar 07, 2005 11:11 pm
Posts: 866
I am glad to see the issue has been resolved. And thank you so much for your solution. :D

Thanks.

_________________
Robert
TWAIN Support Team
http://www.dynamsoft.com/
TWAIN ActiveX/Plug-in HTTP Control/SDK & TWAIN ActiveX Control, Scanner SDK, Component
Software Configuration Management | SCM Solution


Top
 Profile  
 
 Post subject: Re: Problem with OnPostTransfer with IE & Ajax
PostPosted: Fri Jan 14, 2011 12:20 pm 
Offline

Joined: Fri Jan 14, 2011 12:11 pm
Posts: 4
This is an old posting but I'm attempting to accomplish something similar. I've had perfect success using this approach to attach events to the ActiveX control running on IE, but I'm unable to achieve the same result with the embedded add-on using Firefox.

Has anyone found a solution that works with Firefox as well?


Top
 Profile  
 
 Post subject: Re: Problem with OnPostTransfer with IE & Ajax
PostPosted: Fri Jan 14, 2011 11:44 pm 
Offline
User avatar

Joined: Tue Mar 08, 2005 12:23 am
Posts: 1075
Hi azadam,

azadam wrote:
This is an old posting but I'm attempting to accomplish something similar. I've had perfect success using this approach to attach events to the ActiveX control running on IE, but I'm unable to achieve the same result with the embedded add-on using Firefox.

Has anyone found a solution that works with Firefox as well?

We did some tests and it turned out that the method "addEventListener" can't attach the events of Dynamic Web TWAIN to the embedded Plug-in. Currently, we recommend that you attach the events in the normal way:
Code:
         <embed id="DynamicWebTwainFF"
            TYPE="Application/DynamicWebTwain-Plugin"
            
            OnImageAreaDeselected="DynamicWebTwain_OnImageAreaDeselected"
            OnImageAreaSelected="DynamicWebTwain_OnImageAreaSelected"
            OnInternetTransferPercentage="DynamicWebTwain_OnInternetTransferPercentage"
            OnInternetTransferPercentageEx="DynamicWebTwain_OnInternetTransferPercentageEx"
            OnMouseClick="DynamicWebTwain_OnMouseClick"   
            OnMouseDoubleClick="DynamicWebTwain_OnMouseDoubleClick"   
            OnMouseMove="DynamicWebTwain_OnMouseMove"   
            OnMouseRightClick="DynamicWebTwain_OnMouseRightClick"   
            OnPreAllTransfers="DynamicWebTwain_OnPreAllTransfers"
            OnPreTransfer="DynamicWebTwain_OnPreTransfer"
            OnPostTransfer="DynamicWebTwain_OnPostTransfer"
            OnPostAlltransfers="DynamicWebTwain_OnPostAllTransfers"
            OnTopImageInTheViewChanged="DynamicWebTwain_OnTopImageInTheViewChanged"
            OnTransferCancelled="DynamicWebTwain_OnTransferCancelled"
            OnTransferError="DynamicWebTwain_OnTransferError"

            style="text-align:center;height: 480px; width: 500px"
            PLUGINSPAGE="DynamicWebTwain.xpi">      
         </embed>

If you need any further help, please let me know.

_________________
Catherine Sea
TWAIN Support Team
TWAIN ActiveX/Plug-in for Web Applications, Scanner COM Control
TWAIN .NET Component/SDK for Desktop Applications

Follow me @Twitter, Facebook
Image


Top
 Profile  
 
 Post subject: Re: Problem with OnPostTransfer with IE & Ajax
PostPosted: Mon Jul 25, 2011 7:29 am 
Offline

Joined: Fri Jul 22, 2011 7:13 am
Posts: 14
Has there been any progress on this addEventListener() issue since 2005? I believe that I'm experiencing this same issue now. Because we need to add this plugin to the page dynamically, connecting the events via attributes is problematic.


Top
 Profile  
 
 Post subject: Re: Problem with OnPostTransfer with IE & Ajax
PostPosted: Mon Jul 25, 2011 8:09 am 
Offline

Joined: Fri Jan 14, 2011 12:11 pm
Posts: 4
Jason wrote:
Has there been any progress on this addEventListener() issue since 2005? I believe that I'm experiencing this same issue now. Because we need to add this plugin to the page dynamically, connecting the events via attributes is problematic.

I still haven't been able to attach dynamically but would like to know if it's going to be possible. I worked around the issue by creating globally scoped function stubs that are referenced by the object when I put it on the page dynamically, but I'd prefer to clean that up if possible.


Top
 Profile  
 
 Post subject: Re: Problem with OnPostTransfer with IE & Ajax
PostPosted: Mon Jul 25, 2011 10:12 am 
Offline

Joined: Fri Jul 22, 2011 7:13 am
Posts: 14
I was able to get part of the way by defining
Code:
window.DynamicWebTwain_OnImageAreaDeselected = function (event) { };
but event is not provided - I was hoping that FireFox inserts this, but no such luck. If I had the sender of the event, I'd be able to process it correctly, but since I don't have the sender of the event, I cannot route the event handling properly.

The reason for all this hassle is that we have a primarily javascript-based user interface with modules that can be added or removed from the page at will.

Unless this is solved, I have to create and maintain unique names for these handlers such as
Code:
window['DynamicWebTwain_OnImageAreaDeselected'] = function () { self_as_closure.whatever() };


Top
 Profile  
 
 Post subject: Re: Problem with OnPostTransfer with IE & Ajax
PostPosted: Tue Jul 26, 2011 12:06 am 
Offline
User avatar

Joined: Tue Mar 08, 2005 12:23 am
Posts: 1075
Hi Jason,

To look into this issue more closely, shall we have an online meeting? If it is convenient for you, you can contact our support team via Live Help first:
http://www.dynamsoft.com/Support/livehelp.aspx

_________________
Catherine Sea
TWAIN Support Team
TWAIN ActiveX/Plug-in for Web Applications, Scanner COM Control
TWAIN .NET Component/SDK for Desktop Applications

Follow me @Twitter, Facebook
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

It is currently Tue May 22, 2012 1:55 am


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Copyright © 2010 Dynamsoft Corporation. All Rights Reserved. | Knowledge Base | Source Control Blog