PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → Example of Timer in Window
Example of Timer in Window
Débuté par adrianoboller, 21 nov. 2014 13:36 - 6 réponses
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 21 novembre 2014 - 13:36
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
/////////////////////////////////////////////////////////////////////////////////////////////////////
gduTimeNotCounted is Duration
//Are we in pause?
gbPause is boolean
//Cronometro
gbChronoStarted is boolean
//Number of the timer run
gnTimerPrincipal, gnTimerPopup, gnTimerNum, gnTimer, gnTimerIntervalo is int = 0
/////////////////////////////////////////////////////////////////////////////////////////////////////
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 21 novembre 2014 - 13:37
Procedure Timer_Stop()

IF GloDebugSN = "S" THEN
Info("Timer_Stop")
END

//Stop the stopwatch
EndTimerSys(gnTimerNum)

IF gbChronoStarted = True THEN
ChronoEnd(1)
gbChronoStarted = False
END

//Re-initialization
gduTimeNotCounted = 0
gbPause = True
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 21 novembre 2014 - 13:37
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 gbPause = True THEN

//Duration not to count in milliseconds (it is a cumulated duration for all the stops performed)
duDuration is Duration = ChronoEnd(2)
gduTimeNotCounted += duDuration
gbPause = False

ELSE

//Otherwise, initialize the beginning of the stopwatch
ChronoStart(1)
gbChronoStarted = True
gnTimerNum = TimerSys(Timer_Loop,100) //50 meio seg e 100 igual a 1 seg // <<<<---------------------- Importante velocidade do timer

END
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 21 novembre 2014 - 13:38
Procedure Timer_Loop()

IF gbFecharApp 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)

//////////////////////////////////////////////////////////////////////

bPosicaoTaxiOk is boolean = False

sMensagem is string = ""

duDuration is Duration

duDuration = ChronoValue(1)

duDuration = duDuration - gduTimeNotCounted

gnTimer += 1

gnTimerPrincipal += 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 gbFechar = True THEN
gbFechar = 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"
gnPlane = 1
gloTimer20s = 12
gloTimer60s = 50

WS_PosicaoInicial("Alterar")

InicializaAplicativo()

MarcasPlano1()

END


//////////////////////////////////////////CAMADAS/////////////////////////////////////////////

IF gnPlane = 1 THEN

ObjetosPlano01()

ELSE IF gnPlane = 2 THEN

ObjetosPlano02()

END

//////////////////////////////////////////CAMADAS/////////////////////////////////////////////

END//FIM
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 21 novembre 2014 - 13:38
Procedure Timer_Break()

IF GloDebugSN = "S" THEN
Info("Timer_Break")
END

//Suspend the stopwatch
gbPause = True

//Time the time passed that must not be counted
ChronoStart(2)
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 21 novembre 2014 - 13:43
// 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.
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 24 novembre 2014 - 12:15
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)