Timer
Previous topic  First topic  Next topic





Define and Properties


Properties
Status
Default
Planned
Started
Ready
Comments
CREATE TIMER cName | (cVarName) | &(cExpression) 
      [ ; OF cWindow | (cVarName) | &(cExpression) ]
Parent.Name
  
A reference to the Parent Window
      [ ENABLED .T. | .F. ]
.F.
  
Enable or Disable control
      [ INTERVAL nMiliSeconds ]
0
  
Interval wait between each ACTION in miliseconds
      [ ACTION cAction | {BAction} ]
NIL
  
An action that to be performed every Interval
END TIMER 



Methods


Methods
Status
Default
Planned
Started
Ready
Comments
    START
n/a
  
Start Timer
    STOP
n/a
  
Stop Timer
    RELEASE
n/a
  
This method is used to destroy the control.
    ACTION
n/a
  
Execute ACTION block coded in CREATE or seted by mg_Set



Example:

File: d_timer.prg


#include "marinas-gui.ch"

Function main()

   SET APPLSTYLE TO "MarinasLooks"

   CREATE WINDOW d_window
      ROW 0 ; COL 0
      WIDTH 820 ; HEIGHT 480
      CAPTION "Marinas-GUI Sample for Timer Control"
      ICON "../resource/d_test.ico"
      BACKCOLOR {223,242,253}
      MAIN .T.

      d_timer_def()

   END WINDOW

   mg_Do( "d_window" , "center" )

   mg_Do( "d_window" , "activate" )

Return .T.


File: d_timer_def.prg

#include "marinas-gui.ch"

Function d_timer_def()

     CREATE LABEL TimerLabel_1
            ROW    130
            COL     175
            VALUE Time()
            AUTOSIZE .T.
            FONTSIZE 80
            BACKCOLOR {0,0,255}
            FONTCOLOR {149,205,236}
     END LABEL

     CREATE LABEL TimerLabel_2
            ROW    50
            COL    340
            WIDTH  277
            HEIGHT 22
            VALUE "Clock Running"
            FONTSIZE 15
     END LABEL

    CREATE BUTTON TimerButton_1
           ROW    320
           COL    280
           WIDTH  259
           HEIGHT 32
           CAPTION "Stop Clock"
           FONTCOLOR {255,0,0}
           FONTBOLD .T.
           ONCLICK ( mg_Do( "d_window" , "Timer_Clock" , if( mg_Get( "d_window" , "Timer_Clock" , "enabled" ) , "stop" , "start" ) ) , ;
                     mg_Set( "d_window" , "TimerButton_1" , "caption" , if( mg_Get( "d_window" , "Timer_Clock" , "enabled" ) , "Stop Clock" , "Start Clock" ) ) , ;
                     mg_Set( "d_window" , "TimerLabel_1" , "enabled" , if( mg_Get( "d_window" , "Timer_Clock" , "enabled" ) , .T. , .F. ) ) , ;
                     mg_Set( "d_window" , "TimerLabel_2" , "value" , if( mg_Get( "d_window" , "Timer_Clock" , "enabled" ) , "Clock Running" , "Clock Stoped" ) ) )
     END BUTTON

     CREATE SLIDER TimerSlider_1
            ROW    100
            COL    650
            WIDTH  34
            HEIGHT 221
            RANGEMIN 1
            RANGEMAX 5
            VALUE 1
            BACKCOLOR {0,255,30}
            BOTH .T.
            VERTICAL .T.
            ONCHANGE ( mg_Set( "d_window" , "Timer_Clock" , "interval" , mg_Get( "d_window" , "TimerSlider_1" , "value" ) * 1000 ) , ;
                       mg_Set( "d_window" , "TimerLabel_4" , "value" , alltrim( str( mg_Get( "d_window" , "TimerSlider_1" , "value" ) ) ) + " Second(s)" ) )
     END SLIDER

     CREATE LABEL TimerLabel_3
            ROW    330
            COL    650
            WIDTH  120
            HEIGHT 24
            VALUE "Refresh"
     END LABEL

     CREATE LABEL TimerLabel_4
            ROW    350
            COL    640
            WIDTH  120
            HEIGHT 24
            VALUE "1 Second(s)"
     END LABEL

     CREATE TIMER Timer_Clock
        INTERVAL 1000
        ACTION ( mg_setSuspendUserActivityTimestamp( .T. ) , ;
                 mg_Set( "d_window" , "timerLabel_1" , "value" , Time() ) , ;
                 mg_setSuspendUserActivityTimestamp( .F. ) )
        ENABLED .T.
     END TIMER

Return .T.



Marinas-GUI Version 03.06 and
Marinas-IDE Version 05.06 and
LEX Files Version 02.06


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
last update: March 09
2017
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------




A Harbour/QT framework to make multiplatform programs

(©) Copyright 2009-2017 by Fernando Santolin (aka CarozoDeQuilmes)
CarozoDeQuilmes@gmail.com

2009-2017 Beta tester and full English translator: Bruno Luciani
Bruno.Luciani@gmail.com

2014-2015 Final English corrector: David Worboys
DavidWorboys@hotmail.com

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Jump to Donation Topic


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

www.marinas-gui.org


www.marinas-gui.org  

Previous topic  First topic  Next topic