PDA

View Full Version : Timer


hristev
02-10-2005, 03:58 PM
Is there a way to view in a Label how much time is remain when I start the page timer (Page.StartTimer) ?

Corey
02-10-2005, 04:00 PM
Hi. The timer works like a stopwatch, so there is no "remaining" time per se. It simply increments the time by an interval which you specify when you start it. Hope that helps. :)

hristev
02-10-2005, 04:02 PM
Then is there other timer or Plug-in

Corey
02-10-2005, 04:23 PM
Hi. No, because you can easily time anything using the existing timer. Check out the timer examples in the help docs and I'm sure you will be able to get a good overview in about 5-10 minutes. :)

markstaylor
02-10-2005, 05:57 PM
What if you set the timer to run for a certain amount of time(s).
Set a counter=10

Call the timer every second, and subtract 1 from the counter variable.
Then update the label text.

JimS
02-10-2005, 06:35 PM
I agree with Mark,
If what you are trying to do is create a little count down timer, it is fairly easy to implement with the page timer. I built a little example to show you at least one way this can be done.

To see the code used,
Check the ‘On Click’ event of the button.
The ‘On Timer’ event for the page
The Global Functions

Hope this helps.

By the way, the count down interval is in ms, so you would put 1000 if you want the intervals to be 1 second long. Of course the timing won’t be exact, but it should be very close.


.

willfreer
04-21-2005, 02:40 PM
Hi guys, Anyone know how to make an image fade on click after say, 10 seconds?

Derek
04-21-2005, 04:09 PM
Hi guys, Anyone know how to make an image fade on click after say, 10 seconds?
There is more than one way you could do that - here is one for you to try:

In the Images' OnClick event, set the Page timer to start in 10 seconds:
Page.StartTimer(10000);

In the Page's OnTimer event, loop the image opacity to diminish by a specified percent until invisible:
var = 100;
while (var ~= 0) do
var = var - 1;
Image.SetOpacity("Image1", var);
end

Image.SetVisible("Image1", false);

Notice the Image.SetVisible at the end, in order to make the image stay invisible - otherwise it comes right back at ya after 10 secs!

You could also add a line to stop the timer here if it's no longer needed:
Page.StopTimer();

willfreer
04-21-2005, 04:52 PM
AWESOME!!!!

Now when I can't get it to come back, I have three objects, they are linked that are linked on click to an image box (image2) when clicked,

It fades away nicely, when i click on another object nothing apears.

Willie

willfreer
04-23-2005, 07:08 AM
Derek gave me an awesome fading code with timing that works great with images, but I can't get it to work with Labels. (I can't chose set opacity for labels). any Ideals??

Willie

longedge
04-23-2005, 10:03 AM
I had a bit of a mental block awhile back and couldn't work out why one part of my project would just go dead and nothing would respond for several seconds and then I would get a small 'window' of response followed by another dead period.

The cause was for/next loops in the page OnTimer - the application wouldn't respond whilst inside a loop and I'd got nested loops.

If it's working that's fine, but just something to be aware of :) - it took me a while (with help from the forum) to work out what was happening.

You could fake fading the labels by taking a screen shot and use a picture of the label underneath the label itself. Make the label visible and the picture invisible. On the event that you want to use to fade the label make the label invisible and the picture visible but then fade it.

willfreer
04-23-2005, 05:34 PM
Hi

That's a clever way around the problem, thanks, I will try it.

Willi