Focal Point
[SHARING] Maintain timer to exit

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1247019295

November 03, 2010, 06:12 AM
Mats Sjoberg
[SHARING] Maintain timer to exit
Hello
I have attempted to use the timer that was published in a newsletter.
http://www.informationbuilders.../11-4/03_derwin.html

It is an excellent functionality.

The button comes (after a while) up but doesn't disappear when i click to get more time. Also, i don't get more time but am thrown out even if i click on the button.

Has anyone got this working and can help me please?

Regards, Mats

This message has been edited. Last edited by: Kerry,


Mats Sundelin
Cybernetics Business Solutions AB
November 03, 2010, 06:38 AM
Mats Sjoberg
I did a little more testing on this after posting.
The solution is to add an empty Event Handler to the button to receive the click. That way i get a new slot.
Case OnButtonX_Click
EndCase

I also enhanced it a little by moving the button to the middle of the form when displaying (control.style.top ,bottom ,left ,right). That way it can be moved out-of-way in the MDE, not to disturb editing of the form.

My version of the script:
var sTimer=70
// Control id of the button used
var id = "ButtonX";
var control = document.getElementById(id);
control.value=sTimer;
display();

function display(){
var done = 0;
sTimer -= 1;
if( sTimer <= 0 )
done = 1;
if( sTimer <= 10 )
{
control.style.visibility = 'visible';
control.style.backgroundColor = "red";
control.style.top="130px";
control.style.bottom="480px";
control.style.left="300px";
control.style.right="700px";
control.value="Do you need more time? \n Click to continue";
}
else
control.value=sTimer;
if( !done )
{
setTimeout("display()",1000) ;
}
else
{
IWCTrigger("WINEXIT");
window.opener=self;
window.close();
}
}
Regards, Mats


Mats Sundelin
Cybernetics Business Solutions AB
November 03, 2010, 08:31 AM
Maintain Wizard
Hey Mats - Yeah. Sorry about that typo. I am glad that you were able to make it work!