PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WINDEV Mobile 2024
→
Example of Timer in Window
Example of Timer in Window
Started by adrianoboller, Nov., 21 2014 1:36 PM - 6 replies
Connect yourself…
adrianoboller
#1
Registered member
3,659 messages
Popularité : +175 (223 votes)
Posted on November, 21 2014 - 1:36 PM
These are the places Procedures Window tabem the variables used must be local, if it is a watch for any application in different forms can create global variables in the project and put the procedures below in the Main application first screen and monitor the actions of User actions and as execute and automate processes.
Ce sont la fenêtre tabem les variables utilisées doivent être local lieux des procédures, si elle est une montre pour toute application dans différentes formes peuvent créer des variables globales dans le projet et de mettre les procédures ci-dessous dans le premier écran principal de l'application et le suivi des actions de actions de l'utilisateur et que d'exécuter et d'automatiser les processus.
Essas são as Procedures locais de Janela as variaveis usadas devem tabem ser locais, Caso seja um relogio para toda a aplicacao em diferentes formularios pode criar as variaveis no global do projeto e colocar as procedures abaixo na primeira tela Main do aplicativo e monitorar as ações do usuario e conforme ações executar e automatizar processos.
/////////////////////////////////////////////////////////////////////////////////////////////////////
//Timer
/////////////////////////////////////////////////////////////////////////////////////////////////////
gdu
TimeNotCounted
is Duration
//Are we in pause?
gb
Pause
is
boolean
//Cronometro
gb
ChronoStarted
is
boolean
//Number of the timer run
gn
TimerPrincipal
,
gn
TimerPopup
,
gn
TimerNum
,
gn
Timer
,
gn
TimerIntervalo
is
int
=
0
/////////////////////////////////////////////////////////////////////////////////////////////////////
Report
0
0
adrianoboller
#2
Registered member
3,659 messages
Popularité : +175 (223 votes)
Posted on November, 21 2014 - 1:37 PM
Procedure
Timer_Stop
(
)
IF
GloDebugSN
=
"S"
THEN
Info
(
"Timer_Stop"
)
END
//Stop the stopwatch
EndTimerSys
(
gn
TimerNum
)
IF
gb
ChronoStarted
=
True
THEN
ChronoEnd
(
1
)
gb
ChronoStarted
=
False
END
//Re-initialization
gdu
TimeNotCounted
=
0
gb
Pause
=
True
Report
0
0
adrianoboller
#3
Registered member
3,659 messages
Popularité : +175 (223 votes)
Posted on November, 21 2014 - 1:37 PM
Procedure
Timer_Play
(
)
IF
GloDebugSN
=
"S"
THEN
Info
(
"Timer_Play"
)
END
GloOutrasTelas
=
""
//If there is a start time for the stopwatch, it means that time calculation resumes after a stop
IF
gb
Pause
=
True
THEN
//Duration not to count in milliseconds (it is a cumulated duration for all the stops performed)
du
Duration is Duration
=
ChronoEnd
(
2
)
gdu
TimeNotCounted
+
=
du
Duration
gb
Pause
=
False
ELSE
//Otherwise, initialize the beginning of the stopwatch
ChronoStart
(
1
)
gb
ChronoStarted
=
True
gn
TimerNum
=
TimerSys
(
Timer_Loop
,
100
)
//50 meio seg e 100 igual a 1 seg // <<<<---------------------- Importante velocidade do timer
END
Report
0
0
adrianoboller
#4
Registered member
3,659 messages
Popularité : +175 (223 votes)
Posted on November, 21 2014 - 1:38 PM
Procedure
Timer_Loop
(
)
IF
gb
FecharApp
THEN
Close
(
)
END
IF
GloOutrasTelas
=
"S"
THEN
RETURN
END
ok is
boolean
=
False
//STC_Lat = Middle(GloLatitude,1,10)
//STC_Long = Middle(GloLongitude,1,10)
//////////////////////////////////////////////////////////////////////
b
PosicaoTaxiOk is
boolean
=
False
s
Mensagem is
string
=
""
du
Duration is Duration
du
Duration
=
ChronoValue
(
1
)
du
Duration
=
du
Duration
-
gdu
TimeNotCounted
gn
Timer
+
=
1
gn
TimerPrincipal
+
=
1
/////////////////////////////////////////////////////////////VERSAO TABELAS//////////////////////////////////////////////
gloTimer20s
+
=
1
IF
gloTimer20s
=
20
IF
ExisteCadastro
(
) =
True
THEN
ok
=
WS_Taxi_VersaoTabelas
(
""
)
IF
ok
=
False
THEN
gloTimer20s
=
0
END
END
END
/////////////////////////////////////////////////////////////VERSAO TABELAS//////////////////////////////////////////////
//Fechar Popup
IF
gb
Fechar
=
True
THEN
gb
Fechar
=
False
Popup_Esconde
(
)
END
//Fechar Popup
////////////////////////////////////////////////////////////
IF
GloOutrasTelas
=
""
//evita o processamento do loop
//PRIMEIRA VEZ DA APP
IF
gloFecharBemVindo
=
True
THEN
gloFecharBemVindo
=
False
ContadorNaoBuscar
=
5
EDT_
EnderecoOrigem
=
"Rua Doutor Goulin"
EDT_
NumOrigem
=
"1661"
GloVoceEndereco
=
"Rua Doutor Goulin"
GloVoceNumero
=
"1661"
GloVoceLatitude
= -
25.4188156
GloVoceLongitude
= -
49.2445375
GloVoceBairro
=
"Hugo Lange"
GloVoceCidade
=
"Curitiba"
GloVoceUf
=
"PR"
GloVocePais
=
"Brasil"
GloVoceCep
=
"80240-060"
gn
Plane
=
1
gloTimer20s
=
12
gloTimer60s
=
50
WS_PosicaoInicial
(
"Alterar"
)
InicializaAplicativo
(
)
MarcasPlano1
(
)
END
//////////////////////////////////////////CAMADAS/////////////////////////////////////////////
IF
gn
Plane
=
1
THEN
ObjetosPlano01
(
)
ELSE IF
gn
Plane
=
2
THEN
ObjetosPlano02
(
)
END
//////////////////////////////////////////CAMADAS/////////////////////////////////////////////
END
//FIM
Report
0
0
adrianoboller
#5
Registered member
3,659 messages
Popularité : +175 (223 votes)
Posted on November, 21 2014 - 1:38 PM
Procedure
Timer_Break
(
)
IF
GloDebugSN
=
"S"
THEN
Info
(
"Timer_Break"
)
END
//Suspend the stopwatch
gb
Pause
=
True
//Time the time passed that must not be counted
ChronoStart
(
2
)
Report
0
0
adrianoboller
#6
Registered member
3,659 messages
Popularité : +175 (223 votes)
Posted on November, 21 2014 - 1:43 PM
// Init the window
Timer_Play
(
)
// Inicializa o timer
//Se quiser parar o timer use o Timer_Stop() e o Timer_Break()
//em botoes ou eventos da tela ou a variavel: GloOutrasTelas = "S"
//que vai evitar de entrar e processar o que tem dentro do Timer_Loop()
//que é os procedimentos que sua aplicacao deve fazer apos atingir tantos segundos.
//Ou seja, voce tem 4 procedures de controle do relogio comandadas por voce.
Timer_Play
(
)
Timer_Stop
(
)
Timer_Break
(
)
Timer
LOOP
(
)
//Coloque cada uma delas em um botaqo em um forme e faça testes e depois se achou algo a mais deixe aqui o seu comentario.
Report
0
0
adrianoboller
#7
Registered member
3,659 messages
Popularité : +175 (223 votes)
Posted on November, 24 2014 - 12:15 PM
OU
Procedure
Exemplo_Timer
(
)
//EDT_Time1 = TimeSys()
// Process when opening the window
// Disp_Time will be automatically called every second
IF
TimerSys
(
"Disp_Time"
,
100
,
1
) =
0
THEN
Error
(
"Unable to create the timer"
)
END
//TimerSys("Procedure_Name",100,1)
Report
0
0
→ Go back to WINDEV Mobile 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (earlier versions)
Français
English
Español
Portuguesa
Close this window
Search type
Only topics
All the messages
Search period
Any time
Past hour
Past 24 hours
Past week
Past month
Past year
Cancel
Preview of your message
Adding an image
Import an image from a URL
Send an image from a file of your disk
Drop a file or click "Browse..."
or
Cancel
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Text