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
/////////////////////////////////////////////////////////////////////////////////////////////////////
gduTimeNotCountedis Duration
//Are we in pause?
gbPauseisboolean
//Cronometro
gbChronoStartedisboolean
//Number of the timer run
gnTimerPrincipal,gnTimerPopup,gnTimerNum,gnTimer,gnTimerIntervaloisint=0
/////////////////////////////////////////////////////////////////////////////////////////////////////
>
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 21 novembre 2014 - 13:37
ProcedureTimer_Stop()

IFGloDebugSN="S"THEN
Info("Timer_Stop")
END

//Stop the stopwatch
EndTimerSys(gnTimerNum)

IFgbChronoStarted=TrueTHEN
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
ProcedureTimer_Play()

IFGloDebugSN="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
IFgbPause=TrueTHEN

//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
ProcedureTimer_Loop()

IFgbFecharAppTHEN

Close()

END

IFGloOutrasTelas="S"THEN
RETURN
END

ok isboolean=False

//STC_Lat = Middle(GloLatitude,1,10)
//STC_Long = Middle(GloLongitude,1,10)

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

bPosicaoTaxiOk isboolean=False

sMensagem isstring=""

duDuration is Duration

duDuration=ChronoValue(1)

duDuration=duDuration-gduTimeNotCounted

gnTimer+=1

gnTimerPrincipal+=1

/////////////////////////////////////////////////////////////VERSAO TABELAS//////////////////////////////////////////////
gloTimer20s+=1
IFgloTimer20s=20

IFExisteCadastro() =TrueTHEN

ok=WS_Taxi_VersaoTabelas("")

IFok=FalseTHEN
gloTimer20s=0
END

END

END
/////////////////////////////////////////////////////////////VERSAO TABELAS//////////////////////////////////////////////

//Fechar Popup
IFgbFechar=TrueTHEN
gbFechar=False
Popup_Esconde()
END
//Fechar Popup

////////////////////////////////////////////////////////////
IFGloOutrasTelas=""//evita o processamento do loop


//PRIMEIRA VEZ DA APP
IFgloFecharBemVindo=TrueTHEN
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/////////////////////////////////////////////

IFgnPlane=1THEN

ObjetosPlano01()

ELSE IFgnPlane=2THEN

ObjetosPlano02()

END

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

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

IFGloDebugSN="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()

TimerLOOP()

//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

ProcedureExemplo_Timer()

//EDT_Time1 = TimeSys()

// Process when opening the window
// Disp_Time will be automatically called every second
IFTimerSys("Disp_Time",100,1) =0THEN
Error("Unable to create the timer")
END

//TimerSys("Procedure_Name",100,1)
>