473,320 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

javascript waiting for activex to load before execting

hi all,

i have a strange problem here & i'm not sure how to go about fixing
it. Basically, I have a page with an activex control that gets launch
with JS when a user clicks a "connect" button. Now, all i want to do
is disable the button & change the text while the activex is loading.
now, the code below should work, but what i'm seeing is that the js
doesn't even start executing until the activex is loaded. so, what i'm
expecting is the js to run down the function sequentially so:

-the first 2 lines disable & change the text of the button
-the active loads (the button is still disabled)
-activex done load & i re-enable the button.

what actually happens is: when i hit the button, it sits there & loads
the activex, then runs down the function so the disable & re-enable of
the buttons go really fast. any help would be appriciated!

thanks!

-grant.

<object id="MyAppLaunch" type="application/x-oleobject"
classid="CLSID:8E0FDFBC-77D4-43a1-9AD4-41F0EA8AFF7C"
codebase="myapp.cab#version=2,1,0,1">
</object>
<script language="javascript">
<!--

function DoIt()
{
document.form1.Connect.value = "Please Wait...";
document.form1.Connect.disabled = true;

try{
MyAppLaunch.Launch(1,2,3,4,5);
}catch(oException){window.location.href="myapp.exe ";}
}
document.form1.Connect.value = "Connect";
document.form1.Connect.disabled = false;
}
-->
</script>
Jul 23 '05 #1
2 6061
Hi grant,
what actually happens is: when i hit the button, it sits there & loads
the activex, then runs down the function so the disable & re-enable of
the buttons go really fast. any help would be appriciated!


The problem is the way the browser handels its GUI updates. While
running your script, there is no point where control is handed back
to the browser so it can repaint. Therefor the best thing is to make
a small delay in your execution to give the browser some time to repaint
before initializing your object.

function DoIt()
{
document.form1.Connect.value = "Please Wait...";
document.form1.Connect.disabled = true;
window.setTimeout("finishIt();",100);
}

function FinishIt() {

try{
MyAppLaunch.Launch(1,2,3,4,5);
}catch(oException){
window.location.href="myapp.exe";}
}
document.form1.Connect.value = "Connect";
document.form1.Connect.disabled = false;
}

-->
</script>

That should do it.

Good luck,
Vincent

Jul 23 '05 #2
Hi Vincent,

you're absolutely right! I put the setTimeout in there & it works like
a charm. thanks!!

-grant

Vincent van Beveren <vi*****@provident.remove.this.nl> wrote in message news:<40*********************@news.xs4all.nl>...
Hi grant,
what actually happens is: when i hit the button, it sits there & loads
the activex, then runs down the function so the disable & re-enable of
the buttons go really fast. any help would be appriciated!


The problem is the way the browser handels its GUI updates. While
running your script, there is no point where control is handed back
to the browser so it can repaint. Therefor the best thing is to make
a small delay in your execution to give the browser some time to repaint
before initializing your object.

function DoIt()
{
document.form1.Connect.value = "Please Wait...";
document.form1.Connect.disabled = true;
window.setTimeout("finishIt();",100);
}

function FinishIt() {

try{
MyAppLaunch.Launch(1,2,3,4,5);
}catch(oException){
window.location.href="myapp.exe";}
}
document.form1.Connect.value = "Connect";
document.form1.Connect.disabled = false;
}

-->
</script>

That should do it.

Good luck,
Vincent

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: NewbieJon | last post by:
I am attempting to send the variable "sComputerName" from my ActiveX script to "GetInfo.asp" using javascript. (Having been advised this is the way to get my ActiveX variable into my ASP script) ...
5
by: mikeyjudkins | last post by:
Ive been banging my head on the wall for hours with this one, hopefully someone will know what Im doing wrong here :\ The Goal: I have an xml file that is generated on the fly via JSP which I...
7
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of...
0
by: Kunal | last post by:
Hi all, I have run into a problem that I can't quite figure out. Here is the situation: I have to capture a signature from a WebForm. (The ASP.NET application is running on a TabletPC) ...
26
by: Patient Guy | last post by:
Has anyone written code that successfully manipulates binary file data using Javascript? It might---and in the case of doing I/O, will---make use of browser- specific functions (ActiveX/COM with...
5
by: punchbag | last post by:
Hi all, There has recently been a new update to internet explorer whereby activex controls now load on a page unactivated. MSDN have a website explaining a workaround where you do away with the...
90
by: charlesmusco | last post by:
Hi all. I have the following problem. I have an xml file, while I will list below and I am trying to add nodes to the xml document based on user input to a form. The XML doc is ... <?xml...
19
by: Tony | last post by:
I'm working on project that plays movies using Windows Media Player and I'm controlling everything with JavaScript. Per the client I only need to support IE 6 or greater which happens to make...
3
by: sunbeam | last post by:
Short Description of the Project: we developed a e-learning system for our students. each student has a unique username/password to view the modules he/she should view and nothing more. since we...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.