Copyright (1997-2013) EDMGROUP Pty Ltd - EZY Prolog Reference

EZY Timer

New in EZY Prolog

Tutorials

Download EZY Prolog

main page

 

Use EZY Prolog to setup timer and to control timer events.

System allows to setup timers for FRAME objects only.

Timer interval is measured in milliseconds (1 second = 1000 milliseconds)

Frame event handler will receive control every time timer is expired.

 

Sample:

 

 

/* EZY PROLOG. Copyright (C) 2002 EDMGROUP (Australia)

Program loads DCL file with frame ezy_timer.dcl

After frame loaded - program sets:

  • event handler for timer_frame

  • timer for timer_frame with 1 second interval (1000 miliseconds))

Event handler updates edit field every second

*/

 

predicates

determ prolog_main

control_handler: EHANDLER

clauses

prolog_main():-

syspath ( EXEPATH , _ ),

format ( DCL_FILE , "%sezy_timer.dcl" , EXEPATH ),

ezy_form_open ( DCL_FILE , WINDOW ),

FRAME_ADDR =[ "timer_frame" ],

ezy_get_object ( WINDOW , FRAME_ADDR , FRAME_OBJECT ),

ezy_object_handler ( FRAME_OBJECT , control_handler ),

ezy_timer_set ( FRAME_OBJECT , 1000 , TIMERID ),

write ( "Welcome to EZY Prolog\n" ),

write ( "TIMER started " , TIMERID ),

nl .

control_handler( FRAME_OBJECT ,e_timer( ID )):-

EDIT_ADDR =[ "edit" ],

ezy_get_object ( FRAME_OBJECT , EDIT_ADDR , EDIT_OBJECT ),

time ( HH , MM , SS , HHH ),

format ( TIME_MSG , "Time: %:%:%:%" , HH , MM , SS , HHH ),

ezy_object_text ( EDIT_OBJECT , TIME_MSG ),

! .

Copyright 1997-2013 EDMGROUP (Australia)