Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Countdown Timer Error

Countdown Timer Error

Discuss PocketC for Palm OS (including Desktop Edition)

Postby TellarHK on Fri May 11, 2001 5:43 pm

I'm trying a pretty simple thing, really. With the following code...<p>
text(42,46,"seconds remaining.");
for (countdown=12;countdown >= 00;countdown--)
{
text(30,46,countdown);
sleep(1000);
}<br>
I get the error that as the timer counts down, under 10, the position of the digit moves to the left, and I see a countdown from 10, 90, 80, 70, 60, etc... What's the best way to avoid this? Also, I'd REALLY like to see the ability to mix string and function output in a text command.
TellarHK
 
Posts: 2
Joined: Fri May 11, 2001 5:37 pm
Location: USA

Postby slmiller on Fri May 11, 2001 6:14 pm

There are several ways to fix your problem with the extra zero. One is to simply append a space charater to the end of every number below 10. The space will over-write the zero still in the display buffer. Another way is to have the program draw a white rectangle with no border over the text, then write the new text over that. The slowest, but also simplest, option is to have the program clear the output screen before each update of the numbers. I hope this helps. If not, I will clarify.
Stephen

Duct tape is The Force. It has a light side, a dark side, and it holds the world together.
"To beer. The cause of, and solution to, all of life's problems" - Homer Simpson
slmiller
 
Posts: 63
Joined: Mon Jan 08, 2001 6:09 pm
Location: USA

Postby awschwab on Fri May 11, 2001 8:13 pm

If you don't want the digit to move over sideways, you might want to try the texalign() function:

<html>
<title>countd~1.pc</title>
<body>
<b>countd~1.pc</b> (<a href="countd~1.pc">plain text</a>)
<hr>
<pre>
<font color=008000>//countdown.pc
</font><font color=000000>main()
{
</font><font color=0000ff>int </font><font color=000000>countdown;

</font><font color=000000><b>graph_on</b></font><font color=000000>();
</font><font color=000000><b>textalign</b></font><font color=000000>(</font><font color=0000a0>10</font><font color=000000>);
</font><font color=000000><b>text</b></font><font color=000000>(</font><font color=0000a0>42</font><font color=000000>,</font><font color=0000a0>46</font><font color=000000>,</font><font color=000080>"seconds remaining."</font><font color=000000>);
</font><font color=000000><b>textalign</b></font><font color=000000>(</font><font color=0000a0>12</font><font color=000000>);
</font><font color=0000ff>for </font><font color=000000>(countdown=</font><font color=0000a0>12</font><font color=000000>;countdown >= </font><font color=0000a0>00</font><font color=000000>;countdown--)
{
</font><font color=000000><b>text</b></font><font color=000000>(</font><font color=0000a0>40</font><font color=000000>,</font><font color=0000a0>46</font><font color=000000>,</font><font color=000080>" " </font><font color=000000>+ countdown);
</font><font color=000000><b>sleep</b></font><font color=000000>(</font><font color=0000a0>1000</font><font color=000000>);
}
}
</pre>
</body>
</html>

<font size=6></font id=size6><font size=3></font id=size3><font size=6></font id=size6>

Edited by - awschwab on 05/14/2001 08:58:53
awschwab
 
Posts: 270
Joined: Tue Feb 06, 2001 2:33 pm
Location: USA

Postby TellarHK on Thu May 17, 2001 10:00 pm

Thanks for that, awschwab. Unfortunately, that's just what I'm doing now (I didn't send the textalign bit) but the problem is, the artifacts of the last numbers are persisting. slmiller's ideas were good ones, but I haven't been able to figure out just how to implement any of them. What I'd really like to do, is add a space -before- every number under ten. That would help a lot.
TellarHK
 
Posts: 2
Joined: Fri May 11, 2001 5:37 pm
Location: USA

Postby jstadolnik on Fri May 18, 2001 1:11 am

Just do two text calls. Draw spaces with the first, erasing the previous number and draw the new number with the second.

Joe
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby awschwab on Fri May 18, 2001 1:32 pm

My code above does take care of the old digits. Try running it.
awschwab
 
Posts: 270
Joined: Tue Feb 06, 2001 2:33 pm
Location: USA


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 5 guests

cron