|
-
Feb 18th, 2010, 09:46 AM
#1
Thread Starter
PowerPoster
[RESOLVED] Kiosk timer issue
I am writing a simple little kisok app that displays the number of days since the last accident and scrolls through a series of safety jpgs.
When the program loads it asks for date of last reportable accident and stores it. No problem there. I am having 2 issues right now.
1. I have a timer for scrolling the pictures. I want to be able to break into the loop and update the date & close the program, if necessary. I have the proper code in the keydown event. It works fine if the timer is not working.
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF12 Then
StartDate = InputBox("Enter date of last accident")
lbldays.Caption = DateDiff("d", StartDate, Now)
'---------------------
'--set the color
'---------------------
SetColor
ElseIf KeyCode = vbKeyF11 Then
End
End If
End Sub
The timer code is where the issue lies, I think. I tried adding a DoEvents, but that didn't do it. I update the days field again to take care of midneght date change. Not much overhead involved.
Code:
Private Sub Timer1_Timer()
'
'-----------------------------------
' loop through safety pictures
'-----------------------------------
'
lbldays.Caption = DateDiff("d", StartDate, Now)
GetPicture
'---------------------
'--set the color
'---------------------
SetColor
End Sub
The loop for getting the picture. It is in test mode right now, so I only have 2 pictures.
Code:
Public Function GetPicture()
Dim pic As Integer
pic = Int(Rnd(1) * 2) + 1
Dim xx As Picture
Set xx = LoadPicture("C:\safety" & Trim(pic) & ".jpg")
Picture1.Picture = xx
End Function
I need, in the GetPicture function, to be able to center the picture (horizontally and vertically). Right now, they all just align to the upper left corner and do not fill the whole picture frame area.
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Feb 18th, 2010, 10:06 AM
#2
Thread Starter
PowerPoster
Re: Kiosk timer issue
OK, I got the picture stuff fixed. Now, it is just hwo to break into the timer loop to check for a key press.
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Feb 18th, 2010, 10:08 AM
#3
Re: Kiosk timer issue
Why don't you disable the timer, like this:
Code:
Timer1.Enabled=False '~~~> Disable Timer
StartDate = InputBox("Enter date of last accident")
Timer1.Enabled=True '~~~> Enable Timer
...
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Feb 18th, 2010, 10:11 AM
#4
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Feb 18th, 2010, 10:12 AM
#5
Thread Starter
PowerPoster
Re: Kiosk timer issue
I need to know when to disbale the timer. Certainly not on every loop. Somehowm, it needs to allow the system (DoEvents) to check for a function key press.
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Feb 18th, 2010, 10:14 AM
#6
Re: Kiosk timer issue
Have you changed the KeyPreview property of the Form to TRUE ....???
Will that help you...??? ...
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Feb 18th, 2010, 10:17 AM
#7
Thread Starter
PowerPoster
===================================================
If your question has been answered, mark the thread as [RESOLVED]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|