#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