B4A Library MLTimer library

This is an unfinished library. It will include more as time goes on, but I wanted to release the first version now because of the needs of Merlin2049.

This is version 1.0 and only includes a countdown timer. A demo project is inside the zip file. Extract the files and copy the MLTime.jar and MLTime.xml to your additional libraries directory.


MLTime
Author:
Jem Miller - Missing Link Software
Version: 1
  • MLCountDownTimer
    Events:
    • onFinish ( As )
    • onTick (Remaining as Long As )
    Fields:
    • isPaused As Boolean
    Methods:
    • IsInitialized As Boolean
    • Pause
      Pauses the countdown timer
    • Resume
      Resumes the countdown timer from where it left off
    • Start (Millisec As Long, Interval As Long, EventName As String)
      Starts a countdown timer
      MiliSec - Total time for the countdown in milliseconds
      Interval - Amount of time between updates in milliseconds
      EventName - The name of the event to use (Time_onTick for example)
      Example using mltime as the Dim'ed class name
      mltime.Start(60000,1000) will start a countdown timer for 60 seconds and will fire the onTick event every 1 second
      This method triggers 2 events that you can use. Assuming you initialize the class with the event name of Time, they would look like this :
      Time_onTick(Remaining as Long)
      Remaining is the countdown time remaining until done in milliseconds
      Time_onFinish
      This event fires when the countdown is finished
    • Stop
      Stops the countdown timer


Version 1.0 - First release
.
 

Attachments

  • mltime-1.00.zip
    10.7 KB · Views: 353
Last edited:

merlin2049er

Well-Known Member
Licensed User
Longtime User
You've bundled the wrong test app (MLStrings). Is there a method to initializing the timer.
 

HotShoe

Well-Known Member
Licensed User
Longtime User
Oh good grief... I have uploaded the new package. Nothing has changed but the test project.

Thanks guys,

--- Jem
 

HotShoe

Well-Known Member
Licensed User
Longtime User
You've bundled the wrong test app (MLStrings). Is there a method to initializing the timer.

The Start method initializes everything with the values you pass.

--- Jem
 

slugger

Member
Licensed User
Longtime User
Hello,

thanks for this library.

I am trying it right now but it seems to me no matter what Eventname I pass in the Start method the library always expect it to be "cd".

If I try to use another one the Tick event never occur.

Something like this:

B4X:
Dim cdRipp22 As MLCountDownTimer

cdRipp22.Start(120000,100,"cdRipp22")

Sub cdRipp22_onTick(Remaining As Long)
    Log("="&Remaining)
End Sub

If I change "cdRipp22" into "cd" as in your example everything works ok.
 

slugger

Member
Licensed User
Longtime User
Another thing.

The on_finish event, which should occur when the countdown is finished, is also called when the Pause method is invoked.
 

HotShoe

Well-Known Member
Licensed User
Longtime User
Another thing.

The on_finish event, which should occur when the countdown is finished, is also called when the Pause method is invoked.

Thanks, I'll look at both of these tonight.

--- Jem
 
Top