PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 25 → Relógio via código usando as procedures TIMER_STOP, TIMER_LOOP, TIMER_PLAY, TIMER_BREAK
Relógio via código usando as procedures TIMER_STOP, TIMER_LOOP, TIMER_PLAY, TIMER_BREAK
Started by Boller, Sep., 22 2020 12:49 PM - No answer
Registered member
3,655 messages
Popularité : +175 (223 votes)
Posted on September, 22 2020 - 12:49 PM
Prezados,

Segue abaixo um conjunto de procedures para trabalhar com TIMER de Relógio via código usando as procedures:

TIMER_PLAY = INICIA O CONTADOR E O LOOP
TIMER_LOOP = TODOS OS PROCESSOS SEQUENCIAIS A SEREM FEITOS A CADA CICLO
TIMER_STOP = PARA DE CONTAR ATE QUE DER TIMER_PLAY
TIMER_BREAK = PAUSA OU FREIA

Procedure Timer_Break()

//Suspend the stopwatch
Loc_Timer_Pause = True

//Time the time passed that must not be counted
ChronoStart(2)




Procedure Timer_Play()

//If there is a start time for the stopwatch, it means that time calculation resumes after a stop
IF Loc_Timer_Pause = 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
Loc_Timer_Pause = False

ELSE

//Otherwise, initialize the beginning of the stopwatch
ChronoStart(1)
gbChronoStarted = True
gnTimerNum = TimerSys(Timer_Loop,50)

END




Procedure Timer_Stop()

//Stop the stopwatch
EndTimerSys(gnTimerNum)

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

END

//Re-initialization
gduTimeNotCounted = 0
Loc_Timer_Pause = False

//EDT_Duration = "00:00:00"




Procedure Timer_Loop()

duDuration is Duration //Duration (difference) to display

IF Loc_Timer_Pause = True THEN
RETURN
END

IF InternetConnected() = False OR WiFiStatus() = wifiDisabled
BTN_0800..Visible = True
ELSE
BTN_0800..Visible = False
END

//Time passed
duDuration = ChronoValue(1)

//Deduces the duration that must not be counted
duDuration = duDuration - gduTimeNotCounted

gnTimerCadastro += 1

IF gbTermoUso = True THEN

IF gnTimerCadastro > 1 THEN

gnTimerCadastro = 0

aio_HourGlass("Incluindo cadastro...")

gbTermoUso = False

ok is boolean = CadastroConta("Criar","")

//info(ok)

IF ok = True

Teclado("Hide")

Popup("Cadastro incluido com sucesso","C")

aio_HourGlass("")

gbFecharBemVindo = True //ok
gnPlane = 1
GloOutrasTelas = ""

Close()

ELSE

aio_HourGlass("")

END

END

ELSE
gnTimerCadastro = 0
END


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/