chronometer

chronometer

Postby Silvio.Falconi » Tue Apr 05, 2016 8:42 am

where I can see a test for create or simulate a chronometer ( time seconds) ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: chronometer

Postby Antonio Linares » Tue Apr 05, 2016 4:50 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42076
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: chronometer

Postby karinha » Tue Apr 05, 2016 5:49 pm

Code: Select all  Expand view

#Include "FiveWin.Ch"

Static oDlg

//----------------------------------------------------------------------------//

Function Contador_Simples()

DEFINE DIALOG oDlg ;
TITLE "Cronometro Simples" ;
FROM 10, 10 TO 23, 70

oDlg:lHelpIcon := .F.

@ 004, 002 BUTTON "Cronometro" ;
ACTION( Cronometro() ) ;
OF oDlg

@ 004, 015 BUTTON "&Saida" OF oDlg ;
ACTION ( oDlg:End ) CANCEL

ACTIVATE DIALOG oDlg

Return Nil

//----------------------------------------------------------------------------//

Function Cronometro()

Local Cronometro
Local nHora_Calc
Local nSegundos

// Calculo Sobre 24 Horas de um dia... Cada Hora Tem 3.600 Segundos.
Cronometro := 0 // Contador de Segundos do Cronometro.
nHora_Calc := 0 // Quantidade de Horas Que Ele Vai Achar.
nSegundos := 86400 // Quantidade de Segundos Para Se Achar as Horas.

@ 03, 20 Say "Em Segundos " Of oDlg

For Cronometro := 1 To nSegundos // -> Segundos a Calcular Para Horas

nHora_Calc := 0

oDlg:Say( 03, 10, Cronometro )

SysRefresh()

// Formula Para Calcular em Horas...
nHora_Calc := ( nHora_Calc ) + ( Cronometro / 60 ) / 60

Next Cronometro

@ 05, 10 Say "Em Horas: " Of oDlg // Resultado: 24:00:00 hrs.

@ 07, 10 Say nHora_Calc Picture "99.99.99.99" Of oDlg

Return Nil
 


João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7804
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: chronometer

Postby karinha » Tue Apr 05, 2016 5:49 pm

Code: Select all  Expand view

#Include "FiveWin.Ch"

Static nGet
Static oBmp1, oBmp2, oBmp3, oBmp4, oBmp5

//----------------------------------------------------------------------------//

Function Velocimetro()

Local oDlg, oGet

nGet := 0

DEFINE DIALOG oDlg FROM 0, 0 TO 20, 60 ;
TITLE "Mostrando um Velocimetro/Cronômetro"
// Mostrando Barras Verticais no Mostrador(Display)

oDlg:lHelpIcon := .F.

//--------------------Área do DisPlay do Cronômetro------------------------

/* Cada dígito é de 34 x 48 */

/* Copie o "DisPlay.Bmp" de \FW..\BitMaps\ Para o Seu Diretório de Uso */

@ 002, 001 SAY 'Contador : ' OF oDlg

@ 000, 000 BITMAP oBmp1 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg

@ 000, 000 BITMAP oBmp2 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg

@ 000, 000 BITMAP oBmp3 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg

@ 000, 000 BITMAP oBmp4 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg

@ 000, 000 BITMAP oBmp5 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg

//-------------------------------------------------------------------------

oBmp1:nTop := 28
oBmp1:nLeft := 80
oBmp1:nBottom := 52
oBmp1:nRight := 97

oBmp2:nTop := 28
oBmp2:nLeft := 98
oBmp2:nBottom := 52
oBmp2:nRight := 115

oBmp3:nTop := 28
oBmp3:nLeft := 116
oBmp3:nBottom := 52
oBmp3:nRight := 133

oBmp4:nTop := 28
oBmp4:nLeft := 134
oBmp4:nBottom := 52
oBmp4:nRight := 151

oBmp5:nTop := 28
oBmp5:nLeft := 152
oBmp5:nBottom := 52
oBmp5:nRight := 169

//--------------------Área dos Say's---------------------------------------

@ 002, 030 SAY "Evandro 1 Minuto" OF oDlg
@ 2.5, 030 SAY "Tem 60 Segundos " OF oDlg

@ 004, 010 SAY "Use Sua Imaginação... Estás Trabalhando Com Horas..." OF oDlg

@ 005, 010 SAY "Vai Contar até 180 Milésimos de Secs = 3 Segundos. " OF oDlg

@ 006, 010 SAY "By João Santos - In FiveWin The Best! " OF oDlg

@ 007, 010 SAY "Todos os Direitos Reservados - 27/12/2003 " OF oDlg

//--------------------Área dos Botões--------------------------------------

@ 007, 002 BUTTON "&Aumentar" OF oDlg SIZE 40, 12 ;
ACTION ( nGet++, Por_Bmp( oBmp1, oBmp2, oBmp3, oBmp4, oBmp5, nGet ) )

@ 007, 010 BUTTON "&Diminuir" OF oDlg SIZE 40, 12 ;
ACTION ( nGet--, Por_Bmp( oBmp1, oBmp2, oBmp3, oBmp4, oBmp5, nGet ) )

@ 007, 018 BUTTON "&Executar" OF oDlg SIZE 40, 12 ;
ACTION Executar_Bmp()

@ 007, 026 BUTTON "&Saida" OF oDlg ;
ACTION ( oDlg:End ) CANCEL

ACTIVATE DIALOG oDlg CENTERED

EndDialog() // Fechar a Dialog
GlobalFree() // By João Santos - São Paulo - Brazil - Recursos Liberados
ResAllFree() // By Vagner Wirts .And. Elias Junior - Recursos Liberados

Return Nil

//----------------------------------------------------------------------------//

Function Executar_Bmp()

Local I

Local nSegundos

// Fórmula Para Calculo de Horas, Minutos, Segundos, Etc... Ex. Simples
nSegundos := Seconds() + ( 3600 + 5 ) / 60 * 3 //( 3 = Qtde. de Segundos)

For I = 1 To ( nSegundos - Seconds() )

Por_Bmp( oBmp1, oBmp2, oBmp3, oBmp4, oBmp5, I )

SysRefresh()

Next I

Return Nil

//----------------------------------------------------------------------------//

Function Por_Bmp ( oBjeto1, oBjeto2, oBjeto3, oBjeto4, oBjeto5, nQuantidade )

Local cNum := SPACE( 5 )
Local nLen := 3
Local nDigito1 := 3
Local nDigito2 := 3
Local nDigito3 := 3
Local nDigito4 := 3
Local nDigito5 := 3

cNum := STR( nQuantidade )
nLen := LEN( cNum )

nDigito1 := VAL( SUBSTR( cNum, nLen - 4, 1 ) )

If nDigito1 = 0
oBjeto1:nX := -528 // 0 - (11 * 48)
Else
oBjeto1:nX := 0 - ( nDigito1 * 48 )
Endif

nDigito2 := VAL( SUBSTR( cNum, nLen - 3, 1 ) )

If nDigito2 = 0 .AND. nDigito1 = 0
oBjeto2:nX := -528
Else
oBjeto2:nX := 0 - ( nDigito2 * 48 )
Endif

nDigito3 := VAL( SUBSTR( cNum, nLen - 2, 1 ) )

If nDigito3 = 0 .AND. nDigito2 = 0 .AND. nDigito1 = 0
oBjeto3:nX := -528
Else
oBjeto3:nX := 0 - ( nDigito3 * 48 )
Endif

nDigito4 := VAL( SUBSTR( cNum, nLen - 1, 1 ) )

If nDigito4 = 0 .AND. nDigito3 = 0 .AND. nDigito2 = 0 .AND. nDigito1 = 0
oBjeto4:nX := -528
Else
oBjeto4:nX := 0 - ( nDigito4 * 48 )
Endif

nDigito5 := VAL( SUBSTR( cNum, nLen, 1 ) )

oBjeto5:nX := 0 - ( nDigito5 * 48 )

oBjeto5:Refresh( .F. )
oBjeto4:Refresh( .F. )
oBjeto3:Refresh( .F. )
oBjeto2:Refresh( .F. )
oBjeto1:Refresh( .F. )

SysRefresh()

Return Nil
 



João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7804
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: chronometer

Postby karinha » Tue Apr 05, 2016 5:49 pm

Code: Select all  Expand view

#Include "FiveWin.Ch"

Static nGet
Static oBmp1, oBmp2, oBmp3, oBmp4, oBmp5

//----------------------------------------------------------------------------//

Function Velocimetro()

Local oDlg, oGet

nGet := 0

DEFINE DIALOG oDlg FROM 0, 0 TO 20, 60 ;
TITLE "Mostrando um Velocimetro/Cronômetro" ;
STYLE nOR( DS_MODALFRAME )

oDlg:lHelpIcon := .F.

//--------------------Área do DisPlay do Cronômetro------------------------

/* Cada dígito é de 34 x 48 */

/* Copie o "DisPlay.Bmp" de \FW..\BitMaps\ Para o Seu Diretório de Uso */

@ 002, 001 SAY 'Contador : ' OF oDlg

@ 000, 000 BITMAP oBmp1 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg

@ 000, 000 BITMAP oBmp2 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg

@ 000, 000 BITMAP oBmp3 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg

@ 000, 000 BITMAP oBmp4 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg

@ 000, 000 BITMAP oBmp5 FILE "..\BitMaps\DisPlay.Bmp" OF oDlg

//-------------------------------------------------------------------------

oBmp1:nTop := 28
oBmp1:nLeft := 80
oBmp1:nBottom := 52
oBmp1:nRight := 97

oBmp2:nTop := 28
oBmp2:nLeft := 98
oBmp2:nBottom := 52
oBmp2:nRight := 115

oBmp3:nTop := 28
oBmp3:nLeft := 116
oBmp3:nBottom := 52
oBmp3:nRight := 133

oBmp4:nTop := 28
oBmp4:nLeft := 134
oBmp4:nBottom := 52
oBmp4:nRight := 151

oBmp5:nTop := 28
oBmp5:nLeft := 152
oBmp5:nBottom := 52
oBmp5:nRight := 169

//--------------------Área dos Say's---------------------------------------

@ 004, 010 SAY "Caro Usuário Tenha Calma, Espere o Contador Voltar!!" OF oDlg

@ 005, 010 SAY "Vai Contar até 99.999 e Depois Regressa o Cronômetro" OF oDlg

@ 006, 010 SAY "By João Santos - In FiveWin The Best! " OF oDlg

@ 007, 010 SAY "Todos os Direitos Reservados - 27/12/2003 " OF oDlg

//--------------------Área dos Botões--------------------------------------

@ 007, 002 BUTTON "&Aumentar" OF oDlg SIZE 40, 12 ;
ACTION ( nGet++, Por_Bmp( oBmp1, oBmp2, oBmp3, oBmp4, oBmp5, nGet ) )

@ 007, 010 BUTTON "&Diminuir" OF oDlg SIZE 40, 12 ;
ACTION ( nGet--, Por_Bmp( oBmp1, oBmp2, oBmp3, oBmp4, oBmp5, nGet ) )

@ 007, 018 BUTTON "&Executar" OF oDlg SIZE 40, 12 ;
ACTION Executar_Bmp()

@ 007, 026 BUTTON "&Saida" OF oDlg ;
ACTION ( oDlg:End ) CANCEL

ACTIVATE DIALOG oDlg CENTERED

EndDialog() // Fechar a Dialog
GlobalFree() // By Joã£o Santos - São Paulo - Brazil - Recursos Liberados
ResAllFree() // By Vagner Wirts .And. Elias Junior - Recursos Liberados

Return Nil

//----------------------------------------------------------------------------//

Function Executar_Bmp()

Local I

For I = 1 To 99999 // (Step By Step... Indo/Aumentando)

Por_Bmp( oBmp1, oBmp2, oBmp3, oBmp4, oBmp5, I )

SysRefresh()

Next I

//InKey( 1 ) // Pode-se usar este comando velho do Clipper!
SysWait( .1 ) // Eu somente uso FiveWin! He he he he...

For I = 99999 To 1 STEP -1 // (Step By Step... Voltando/Diminuindo)

Por_Bmp( oBmp1, oBmp2, oBmp3, oBmp4, oBmp5, I )

SysRefresh()

Next I

Return Nil

//----------------------------------------------------------------------------//

Function Troca_Bmp( oBmp1, oBmp2, oBmp3, lSinal )

STATIC nCont := 0

Local nInc := IIF( lSinal, 1, -1 )
Local nCam := IIF( lSinal, -528, -527 )
Local nTopeI := IIF( lSinal, -576, 0 )
Local nTopeS := IIF( lSinal, 0, -576 )

If ! lSinal .And. nCont == 0
Return Nil
Endif

If oBmp3:nX == nTopeI
oBmp3:nX := nTopeS
Endif

If oBmp2:nX == nTopeI
oBmp2:nX := nTopeS
Endif

If oBmp1:nX == nTopeI
oBmp1:nX := nTopeS
Endif

oBmp3:nX -= nInc
nCont += nInc

If oBmp3:nX <= nCam
oBmp2:nX -= nInc
If oBmp2:nX <= nCam
oBmp1:nX -= nInc
Endif
Endif

oBmp3:Refresh( .F. )
oBmp2:Refresh( .F. )
oBmp1:Refresh( .F. )

Return Nil

//---------------------------------------------------------------------------//

Function Por_Bmp ( oBjeto1, oBjeto2, oBjeto3, oBjeto4, oBjeto5, nQuantidade )

Local cNum := SPACE( 5 )
Local nLen := 0
Local nDigito1 := 0
Local nDigito2 := 0
Local nDigito3 := 0
Local nDigito4 := 0
Local nDigito5 := 0

cNum := STR( nQuantidade )
nLen := LEN( cNum )

nDigito1 := VAL( SUBSTR( cNum, nLen - 4, 1 ) )

If nDigito1 = 0
oBjeto1:nX := -528 // 0 - (11 * 48)
else
oBjeto1:nX := 0 - ( nDigito1 * 48 )
Endif

nDigito2 := VAL( SUBSTR( cNum, nLen - 3, 1 ) )

If nDigito2 = 0 .AND. nDigito1 = 0
oBjeto2:nX := -528
else
oBjeto2:nX := 0 - ( nDigito2 * 48 )
Endif

nDigito3 := VAL( SUBSTR( cNum, nLen - 2, 1 ) )

If nDigito3 = 0 .AND. nDigito2 = 0 .AND. nDigito1 = 0
oBjeto3:nX := -528
else
oBjeto3:nX := 0 - (nDigito3 * 48)
Endif

nDigito4 := VAL( SUBSTR( cNum, nLen - 1, 1 ) )

If nDigito4 = 0 .AND. nDigito3 = 0 .AND. nDigito2 = 0 .AND. nDigito1 = 0
oBjeto4:nX := -528
else
oBjeto4:nX := 0 - (nDigito4 * 48)
Endif

nDigito5 := VAL( SUBSTR( cNum, nLen, 1 ) )

oBjeto5:nX := 0 - ( nDigito5 * 48 )

oBjeto5:Refresh( .F. )
oBjeto4:Refresh( .F. )
oBjeto3:Refresh( .F. )
oBjeto2:Refresh( .F. )
oBjeto1:Refresh( .F. )

SysRefresh()

Return Nil
 


João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7804
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: chronometer

Postby Silvio.Falconi » Tue Apr 05, 2016 8:47 pm

Antonio,
do U use now VB ?
Do U have left the fantastic world of Fivewin?
Recently I reached the venereal age 50, :D but I still enjoy the evening to create small programs and applications for my friends with Fivewin, ... thanks to you !!! :mrgreen: :mrgreen: :mrgreen: :mrgreen:

karinha,
I need a string type "00:00:00:00"
the first sample test is not valid for me
the second sample test I not use bitmaps but only string
I must give to a say control ...a string
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: chronometer

Postby Antonio Linares » Wed Apr 06, 2016 12:07 pm

Dear Silvio,

I don't use VB at all as Harbour provides me all that I need :-)

I thought that a VB video could be inspiring for the user interface design
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42076
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: chronometer

Postby Silvio.Falconi » Thu Apr 07, 2016 6:57 pm

Resolved !!

Image

But I see Hour : minutes : seconds
Only I asked myself how I can make to have millisecs ? and partial ?


I use the function SecsToTime( nTimeInSecs ) to show the chronometer
how I can modify it to have also milliseconds ?

function SecsToTime( nTimeInSecs )

local nHours := Int( nTimeInSecs / 3600 )
local nMins := Int( nTimeInSecs % 3600 / 60 )
local nSecs := Int( nTimeInSecs - ( nHours * 3600 ) - ( nMins * 60 ) )

return StrZero( nHours, 2 ) + ":" + StrZero( nMins, 2 ) + ":" + ;
StrZero( nSecs, 2 )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: chronometer: RESOLVED!!

Postby Silvio.Falconi » Thu Apr 07, 2016 7:53 pm

RESOLVED !!!

Image

AS FORMULA One

also with Partial times
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm

Re: chronometer

Postby Massimo Linossi » Fri Apr 08, 2016 7:32 am

Lunch ???
You can also change the reset button with "breakfast"
User avatar
Massimo Linossi
 
Posts: 498
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Re: chronometer

Postby Silvio.Falconi » Fri Apr 08, 2016 8:55 am

yes of course

Now I add also another button with "Dinner" only for you !!!

p.s. Christmas is over for a long time, it's time to change the hat?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7048
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 104 guests

cron