Notices

Water Fountain General Chit/Chat

Reply
 
LinkBack Thread Tools
Old 07-24-03, 09:59 AM   #1 (permalink)
Aximsite All Star
 
aardWolf's Avatar
Super Member
 
Join Date: Apr 2003
Location: Olive Branch, MS
Posts: 594
Device: iPhone 4GB
Thanked 0 Times in 0 Posts

Awards Showcase
Aximsite Contest Winner Reviewer Medal Aximsite Silver Contributors 
Total Awards: 3

eVB and waiting

Does anyone know an embedded Visual Basic command I can use to make the PPC wait without bringing up that stupid round logo? I want to do a type of animation using a picture box, and I need the PPC to wait a half second or so before displaying the next image.

It seems like sleep() should work, but I'm having problems getting it to work. Any advice?
aardWolf is offline   Reply With Quote
Sponsor Ads
Old 07-24-03, 10:40 AM   #2 (permalink)
Aximsite Elite
 
silentknight's Avatar
Addicted Member
 
Join Date: Jan 2003
Location: GR, Michigan
Posts: 3,380
Device: Nokia 6255i
Carrier: Alltel
Thanked 1 Time in 1 Post

Awards Showcase
Aximsite Active Silver Member Aximsite Veteran Staff Moderator Medal 
Total Awards: 3

sleep doesnt work ? ... hmm...
it works fine in eVC++ ..

Have you tried just a timeout routine? something like
this:

Sub Timeout(duration)
On Error Resume Next
StartTime = Timer
Do While Timer - StartTime < duration
'do nothing....
'in standard VB, I put a "doevents" in here...
Loop
End Sub


Note, this is my code from standard visual basic
I have not tried it in Embedded yet.... use
at your own risk... and dont time out too long..
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


My recent reviews:

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
silentknight is offline   Reply With Quote
Old 07-25-03, 11:30 PM   #3 (permalink)
Aximsite All Star
 
Join Date: Dec 2002
Posts: 744
Thanked 0 Times in 0 Posts
Put the image stepping code (no time regulation) in a timer element and set the interval of the element to 1000.

ex. code inside timer, image(i)= string array with content of location of each frame:

For I = 1 to 10 'ten frames
Picture1.picture=image(i)
Next I


From then on with the with the interval set to 1000 (interval is the delay in milliseconds), 10 pictures will be loaded, one every second.

I've used a timer element to control the ball in a Break Out clone I was working on in eVB. It is annoying that eVB isn't as fully featured as desktop VB, it doesn't support elements as arrays, which means I need huge if then lists, instead of single if then inside a for next to figure out if a brick has been hit. :(
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Tom61 is offline   Reply With Quote
Old 07-26-03, 12:15 AM   #4 (permalink)
Aximsite All Star
 
aardWolf's Avatar
Super Member
 
Join Date: Apr 2003
Location: Olive Branch, MS
Posts: 594
Device: iPhone 4GB
Thanked 0 Times in 0 Posts

Awards Showcase
Aximsite Contest Winner Reviewer Medal Aximsite Silver Contributors 
Total Awards: 3

Well, I ended up doing something similar. I'm animating opening and closing a menu. The images are called menu0.bmp, menu1.bmp... menu4.bmp. I set a variable to -1, and have a timer event run every half second. If I want the image to go from menu0 - menu4, I set the variable=0, and the timer event takes over, incrementing the variable by 1 and displaying the new picture until the variable=5. To start it in reverse, I just set the variable=4.
__________________
Lawson Culver

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
aardWolf is offline   Reply With Quote
Old 07-28-03, 03:54 PM   #5 (permalink)
Aximsite All Star
 
Join Date: Dec 2002
Posts: 744
Thanked 0 Times in 0 Posts
So, you're having the timer run constantly?

A cleaner way is to leave the interval of the element set to 0 at startup, then whatever event you'd normally set that variable to 0, have that set timer1.interval=500, and then at the point you'd reset the variable=-1 set it to 0 instead and after that set timer1.interval=0.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Tom61 is offline   Reply With Quote
Old 07-28-03, 03:57 PM   #6 (permalink)
Aximsite All Star
 
aardWolf's Avatar
Super Member
 
Join Date: Apr 2003
Location: Olive Branch, MS
Posts: 594
Device: iPhone 4GB
Thanked 0 Times in 0 Posts

Awards Showcase
Aximsite Contest Winner Reviewer Medal Aximsite Silver Contributors 
Total Awards: 3

Well, I can also enable/disable the timer when I need it to make it more efficient. :P
aardWolf is offline   Reply With Quote
Old 10-07-03, 06:01 PM   #7 (permalink)
Aximsite Legend
 
Howard2k's Avatar
Addicted Member
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 13,721
Thanked 4 Times in 4 Posts

Awards Showcase
Aximsite Active Silver Member Moderator Medal Silver Poster 
Total Awards: 3

On a related note... Man I feel like such a newbie.. I'm trying to use the timer control.l

From in the app there it looks like this:
x does not = y
do while x = y
'do stuff here..
timer1.interval = 5000
timer1.enabled = true
call timer1_timer



private sub timer1_timer()
'more stuff goes on in here.
'this stuff actually DOES get executed, but there is no "pausing"
End Sub


From what I understand (which is clearly wrong) the timer loop should execute, wait for the timer interval and then execute again. But it just FLIES right through..

Any idea what I'm doing wrong?
__________________
Always read stuff that will make you look good if you die in the middle of it.
Howard2k is offline   Reply With Quote
Old 10-07-03, 08:14 PM   #8 (permalink)
Aximsite Administrator
 
deftech's Avatar
Addicted Member
 
Join Date: Feb 2003
Location: Arkansas
Posts: 5,635
Thanked 3 Times in 2 Posts

Awards Showcase
Moderator Medal Admin Medal Bronze Poster 
Total Awards: 3

Howard,

I'm not sure exactly what you're trying to do.

To slow it down, try putting a much lower interval in there. Maybe like 300? Just play around with some lower intervals, and it should make it wait longer before re-executing.

Timer's not going to wait long though....going to be decently speedy no matter what. It's really more useful for clock or timer type of use.
__________________
Jordan M. Wigley
Aximsite.com
Email: jordan AT aximsite.com


.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Come join the friendly community at
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
deftech is offline   Reply With Quote
Old 10-07-03, 08:43 PM   #9 (permalink)
Aximsite Legend
 
Howard2k's Avatar
Addicted Member
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 13,721
Thanked 4 Times in 4 Posts

Awards Showcase
Aximsite Active Silver Member Moderator Medal Silver Poster 
Total Awards: 3

Hey deftech,

I'm actually trying to move an object across the screen..

I'm using the picturebox1.drawpicture technique and incrementing the start X value. The problem is that it SHOOTS across the screen too fast and I need it to meander across the screen.

So in my main code I'm using a
Do While variableend = false
call timer1_timer
loop

The time process has all the functionality.

It has:
private sub timer1_timer()
timer1.enabled = true
timer1.interval = 500 'I've been playing around with different numbers"
picturebox1.drawpicture
increment x value
if x > 100 then
variableend = true
timer1.enabled = false
endif
end sub



So I know that my test condition works, the object does move across the screen as required. It's just that the timer loop shoots through with no delay. Should I be calling it using a different method? call timer1_timer(500) or something?

It's got to be something simple staring me in the face.. Just my naivity is preventing me from seeing it no doubt..
__________________
Always read stuff that will make you look good if you die in the middle of it.
Howard2k is offline   Reply With Quote
Old 10-07-03, 10:31 PM   #10 (permalink)
Aximsite All Star
 
Join Date: Dec 2002
Posts: 744
Thanked 0 Times in 0 Posts
The problem is that you're treating the timer element as a subroutine, and you're confusing it.

Demo code time:
Open a new project make 2 command buttons and 1 timer element
Double click on the command1 button and type timer1.interval=500

Quote:
Private Sub Command1_Click()
Timer1.Interval = 500
End Sub
go back to form, double click on the timer element and type command1.Left=command1.Left+5

Quote:
Private Sub Timer1_Timer()
Command1.Left = Command1.Left + 5
End Sub
go back to form, double click on the command2 button and type timer1.interval=0

Quote:
Private Sub Command2_Click()
Timer1.Interval = 0
End Sub
See? Timer element not subroutine. Timer exists outside of any other code.

Clicking on Command1 starts Command1 moving, Command2 stops Command1 moving.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Tom61 is offline   Reply With Quote
Old 10-08-03, 08:42 AM   #11 (permalink)
Aximsite Legend
 
Howard2k's Avatar
Addicted Member
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 13,721
Thanked 4 Times in 4 Posts

Awards Showcase
Aximsite Active Silver Member Moderator Medal Silver Poster 
Total Awards: 3

I think I get it.. So I should be just enabling and disbling the timer, or setting it's interval to 0 or >0 during the main program. Not actually calling it.

I think I get it, I'll try that.


Thanks for your help.
__________________
Always read stuff that will make you look good if you die in the middle of it.
Howard2k is offline   Reply With Quote
Old 10-08-03, 08:58 AM   #12 (permalink)
Aximsite Legend
 
Howard2k's Avatar
Addicted Member
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 13,721
Thanked 4 Times in 4 Posts

Awards Showcase
Aximsite Active Silver Member Moderator Medal Silver Poster 
Total Awards: 3

ok, I think maybe I'm closer, but I'm not sure.

I have a certain point in the program where the timer needs to execute and the program itself has to basically pause until a condition is set by the timer.

so I have
variableend = false
timer1.interval = 500
do while variableend = false
loop



and I have

timer1_timer()
do stuff in here
when conditions are met, set variableend = true


But the timer1 statements are not executing. I placed a msgbox pop-up in there and it's not appearing, instead the application now just locks...


Is this something to do with the do while loop that I have?

Thanks for the help, I really appreciate it.
__________________
Always read stuff that will make you look good if you die in the middle of it.
Howard2k is offline   Reply With Quote
Old 10-08-03, 09:57 AM   #13 (permalink)
Aximsite Legend
 
Howard2k's Avatar
Addicted Member
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 13,721
Thanked 4 Times in 4 Posts

Awards Showcase
Aximsite Active Silver Member Moderator Medal Silver Poster 
Total Awards: 3

I also tried:

variableend = false
timer1.interval = 500
do while variableend = false
test condition and change variableend if needed
loop



and I have

timer1_timer()
do stuff in here
don't test condition, just perform actions
__________________
Always read stuff that will make you look good if you die in the middle of it.
Howard2k is offline   Reply With Quote
Old 10-08-03, 10:00 AM   #14 (permalink)
Aximsite All Star
 
aardWolf's Avatar
Super Member
 
Join Date: Apr 2003
Location: Olive Branch, MS
Posts: 594
Device: iPhone 4GB
Thanked 0 Times in 0 Posts

Awards Showcase
Aximsite Contest Winner Reviewer Medal Aximsite Silver Contributors 
Total Awards: 3

I don't have eVB installed here, so I'm kinda doing this from memory... You need to actually activate the timer. I think it might be something like:
timer1.enable.true or maybe timer1.enable.1

:)
__________________
Lawson Culver

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
aardWolf is offline   Reply With Quote
Old 10-08-03, 10:11 AM   #15 (permalink)
Aximsite Legend
 
Howard2k's Avatar
Addicted Member
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 13,721
Thanked 4 Times in 4 Posts

Awards Showcase
Aximsite Active Silver Member Moderator Medal Silver Poster 
Total Awards: 3

Yep I have that too, timer1.enabled = true


So the timer is enabled both in the propery on the form and from within the form, I just start with with the interval at 0 and then changed it to 500 when I needed to execute the code within the timer object.

Thanks anyway :) I'll keep playing, bound to be something simple.

I tried both, but is there any real difference between form1.timer1.property and timer1.property?

Or would you use the former when referencing the timer from another form and the latter from within the form?
__________________
Always read stuff that will make you look good if you die in the middle of it.
Howard2k is offline   Reply With Quote
Reply

Sponsor Ads

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 05:17 PM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Copyright © 2003-09 LeckMedia, LLC