Topic: APLX Help : System Classes : List of Classes : Timer
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

Timer


Description

The Timer class implements a periodic timer. This is an invisible object, which calls the onTimer callback at a fixed interval (provided the object's enabled property is 1). The time interval is set by the interval property, and is expressed in milliseconds.

A Timer object can be a top-level object (created directly using ⎕NEW,or the New or Create method of ⎕WI). It can also be the child of the System object, of a Window or Form, or of any standard control. It cannot be the child of a pre-defined dialog or another Timer object.

Example

     ∇DEMO_Timer;CB_TIMER;DEMO
[1]   ⍝ Sample function demonstrating use of the Timer object
[2]   DEMO←'⎕' ⎕NEW 'Window'
[3]   DEMO.where←4 4 ⋄ DEMO.scale←1 ⋄ DEMO.size←7 30
[4]   DEMO.title←'Timer Example'
[5]   DEMO.myLabel.New 'Label' ⋄ DEMO.myLabel.where←2 1
[6]   DEMO.myLabel.caption←''
[7]   ⍝ Set up 1-second timer which updates the label text
[8]   DEMO.myTimer.New 'Timer' ⋄ DEMO.myTimer.interval←1000
[9]   ⍝ Create a little callback function which will run once a second
[10]  0 0⍴⎕FX 'CB_TIMER' 'DEMO.myLabel.caption←⎕TIME'
[11]  DEMO.myTimer.onTimer←'CB_TIMER'
[12]  ⍝
[13]  ⍝ Wait for the user to close the window
[14]  0 0⍴1 ⎕WE DEMO
     ∇

Properties

children class data enabled events interval methods name opened properties self tie

Methods

Close Create Delete New Open Send Set Trigger

Callbacks

onClose onDestroy onOpen onSend onTimer


Topic: APLX Help : System Classes : List of Classes : Timer
[ Previous | Next | Contents | Index | APL Home ]