Executes code at intervals
Ancestors - Object (PRIM_OBJT)
The Timer control is used to execute code at intervals. The Interval property defines the millisecond gap between each Tick. The single threaded nature of the LANSA runtime means that a timer tick is queued. Any activity already in progress will complete before the timer ticks.
This example demonstrates basic timer functionality.
Begin_Com Role(*EXTENDS #PRIM_WEB) Height(457) Width(1169) Define_Com Class(#PRIM_VS.Style) Name(#Style1) Backgroundbrush(#Brush1) Foregroundbrush(#Brush2) Define_Com Class(#PRIM_VS.SolidBrush) Name(#Brush2) Color(Theme50) Define_Com Class(#PRIM_VS.SolidBrush) Name(#Brush1) Color(Theme500) Define_Com Class(#prim_timr) Name(#Timer) Startup(Manual) Define_Com Class(#PRIM_PHBN) Name(#StartStop) Caption('Start') Displayposition(1) Left(24) Parent(#COM_OWNER) Tabposition(1) Top(32) Width(169) Define_Com Class(#PRIM_SPDT) Name(#Interval) Displayposition(2) Left(96) Parent(#COM_OWNER) Showselection(False) Showselectionhilight(False) Tabposition(2) Top(96) Width(96) Define_Com Class(#PRIM_LABL) Name(#Label1) Caption('Interval') Displayposition(3) Ellipses(Word) Height(25) Left(24) Parent(#COM_OWNER) Tabposition(3) Tabstop(False) Top(96) Verticalalignment(Center) Width(57) Define_Com Class(#PRIM_LABL) Name(#Ticking) Displayposition(4) Ellipses(Word) Height(90) Left(208) Parent(#COM_OWNER) Tabposition(4) Tabstop(False) Top(31) Verticalalignment(Center) Width(242) Alignment(Center) Style(#Style1) Caption('Ticking') Visible(False) Evtroutine Handling(#Com_owner.CreateInstance) #Interval := #Timer.Interval Endroutine Evtroutine Handling(#Interval.Changed) #Interval := #Interval.Value.Max( 1 #Interval.Value ) #Timer.Interval := #Interval Endroutine Evtroutine Handling(#StartStop.Click) If (#Timer.IsStarted) #Timer.Stop #StartStop.Caption := "Start" #Ticking.visible := False Else #Timer.Start #StartStop.Caption := "Stop" Endif Endroutine Evtroutine Handling(#Timer.Tick) #Ticking.visible := *Not #Ticking.Visible Endroutine End_Com
Name | Description |
---|---|
ComponentClassName | ComponentClassName is the name of the component's class. Inherited from Object (PRIM_OBJT) |
ComponentMembers | ComponentMembers provides access to all the member components of this component Inherited from Object (PRIM_OBJT) |
ComponentPatternName | ComponentPatternName is used to qualify the class of the component. Inherited from Object (PRIM_OBJT) |
ComponentTag | Generic space allowing a value to be stored for the instance Inherited from Object (PRIM_OBJT) |
ComponentType | ComponentType gives you access to the type information about the component Inherited from Object (PRIM_OBJT) |
ComponentTypeName | ComponentTypeName is the fully qualified name of the component's class. Inherited from Object (PRIM_OBJT) |
Interval | Number of milliseconds between each tick |
IsStarted | Returns true if the timer is currently running |
Name | Name identifies the component Inherited from Object (PRIM_OBJT) |
Owner | Owner owns this component Inherited from Object (PRIM_OBJT) |
Parent | The component instance to which this instance is attached. The visual container for a control or the collector of a set of child instances Inherited from Object (PRIM_OBJT) |
Startup | Defines whether the timer is started automatically or manually |
Name | Description |
---|---|
CreateInstance | CreateInstance is signalled when an instance of a component is created Inherited from Timer (PRIM_TIMR) |
DestroyInstance | DestroyInstance is signalled when an instance of a component is about to be destroyed Inherited from Timer (PRIM_TIMR) |
Tick | Fired whenever the specified interval has elapsed |
Name | Description |
---|---|
Start | Start method starts the timer |
Stop | Stop method stops the timer |
Febuary 18 V14SP2