I got this code from an earlier post. Using the NotesTimer class I am placing a stopwatch on a Notes form
I placed this in the Forms Global Declarations section
Dim elapsedTime As Integer
Dim elapsedTimer As NotesTimer
I place this code in a START button on the form
Dim workspace As New notesuiworkspace
Dim uidoc As notesuidocument
Set uidoc=workspace.currentdocument
elapsedtime=Val(uidoc.fieldgettext("timer"))
Set elapsedTimer = New NotesTimer(1, "Elapsed time since starting the timer")
On Event Alarm From elapsedTimer Call elapsedTimerHandler
I also create a sub function under that same button
Sub elapsedTimerHandler(Source As NotesTimer)
elapsedTime = elapsedTime + 1
Dim workspace As New notesuiworkspace
Dim uidoc As notesuidocument
Set uidoc=workspace.currentdocument
Call uidoc.fieldsettext("timer",Str(elapsedtime))
Call uidoc.fieldsettext("hours_total",Format(elapsedtime/90000 ,"h:m:ss"))
End Sub
And I create a button to STOP the stop watch
Sub Click(Source As Button)
elapsedTimer.enabled=False
End Sub
Aside from that I place two fields on the form. One hidden to keep track of the total time in seconds and another to keep track of the time in formatted hh:mm:ss
This code works fine on a PC but it will not work on a MAC running notes. When the start button is pushed on a MAC it counts up to maybe 1-4 seconds and stops. On a pc it counts up functions like a regular stop watch. You can click the stop button to pause/stop the clock and start to restart it.
-
What part of the code above does not function on a Mac and how can I work around it.
-
On a PC when the page looses focus and I change to the Workspace Tab I get a Notes Error- Can not locate field. What is causing this and how can I work around it. I also can not open another form with the same stop watch as it then inherits the time on the stopwatch from the first form
Thanks