WVG / WVW - PROGRESS BAR - é possível?

GTWVG com API Windows somente no Harbour.
No Harbouir 3.4 está sendo usado pointer, aonde no 3.2 é numérico.

Moderador: Moderadores

microvolution
Usuário Nível 5
Usuário Nível 5
Mensagens: 1231
Registrado em: 02 Set 2011 22:17
Contato:

WVG / WVW - PROGRESS BAR - é possível?

Mensagem por microvolution »

Boa tarde!
Antes de mais nada, gostaria de agradecer a todos, que nos últimos 5 anos, contribuíram para meu aprendizado e evolução. Não quero aqui citar nomes, pra não ser injusto, caso esqueça algum. Sou muito grato, por terem nos aguentado, tolerado, mas, acima de tudo, terem me ensinado o pouco que consegui captar e aprender.
Não pretendo mais criar novos projetos em clipper/harbour e suas libs, e nem fazer melhorias, mas, apenas manter o que já tem pronto e corrigir bugs, etc.

Bom... preciso de um help...

Tenho um módulo em que um cliente quer excluir tudo que já foi baixado nos dbf/ntx. E, pra não haver nenhuma redundância dos dados, ao usar o DBU32, criei um módulo externo (outro .exe) que faz isso, feito 100% em gtwg/wvw e compilado via .bat.

Está em modo gráfico e muito funcional em todos os aspectos (ao nosso ver), exceto, que, como o "sisteminha" usa os SET FILTERs e manipula diversos DBFs/NTXs ao mesmo tempo, pra excluir um ano de informações, pode levar até 5 horas de trabalho.

Criei um PROGRESS BAR feito com caracteres alphanuméricos como uma BARRA DE ANDAMENTO, mas, não tem funcionado corretamente.

Alguém tem algum scritp que rede numa THREAD paralela ou na própria TREAD principal que mostre o andamento da exclusão, baseada no tamanho dela?

tipo assim (apenas exemplos):
1) se for 100 registros a serem excluídos, 10 caracteres ao todo pra representar o 100%, cada um se movendo para representar 10 registros excluídos;
2) se for 1.000 registros a serem excluídos, 10 caracteres ao todo também, cada um se movendo para representar 100 exclusões.

Não sei se expliquei ou se compliquei.

OBS.:
O PROGRESS BAR que encontrei foi apenas na HMG que uso, que é a 3.5.0.1. Existe como fazer isso em GTWVG ou GTWVW ou GTWVT?
Grato,
MICROVOLUTION - 16 anos Evoluindo Com Você!


Você já leu a Bíblia hoje?
João 3:16 - Porque Deus amou ao mundo de tal maneira que deu seu Único Filho para que todo aquele que nEle crê não pereça mas tenha a Vida Eterna!
Avatar do usuário
Nascimento
Usuário Nível 4
Usuário Nível 4
Mensagens: 763
Registrado em: 19 Jul 2008 12:11
Localização: OLINDA-PE

WVG / WVW - PROGRESS BAR - é possível?

Mensagem por Nascimento »

ja fiz em wvt, vou procurar baseado em um que tinha aqui no forum mesmo salvo engano

Código: Selecionar todos

************************************
function eprogresso(vtxt,xperc,wtot)
*************************************
  local npre:=(xperc*100)/wtot,nbar:=(npre*74)/100
  local p_file:=vtxt
  p_file:=right (p_file,12)
  p_file:=Substr(p_file,at("\",p_file)+1,9)
  p_file=left(p_file,at(".",p_file)-1)
  @ 4, 5 say "Total de Arquivos Concluidos..: "+str(npre,3,0) + " %"
  @ 5, 5 say "Processando Arquivo: "+left(p_file+spac(30),44)
return nil  
********************************

A arte de programar é simplesmente fazer seus pensamentos serem interpretados por uma maquina :) clipper 5.3 /harbour/minigui
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

WVG / WVW - PROGRESS BAR - é possível?

Mensagem por JoséQuintas »

Talvez agilize fazer isso através de índice.
Mas é tanta coisa assim pra excluir?

Tem aquele meu, de sempre, que mostra até o tempo estimado pra terminar.
Uso até na reindexação, mas aí precisa algo mais.
Basicamente é GrafTempo( "texto" )
e depois GrafTempo( nAtual, nTotal )
Pra usar em DBF, sem índice, pode usar RecNo() e LastRec().
Se for com índice, cria nAtual := 0, e na chamada GrafTempo( nAtual++, LastRec() )

Código: Selecionar todos

/*
ZE_GRAFTEMPO - GRAFICOS DE PROCESSAMENTO
1990.05 - José Quintas
*/

#include "inkey.ch"
#include "set.ch"
#include "josequintas.ch"

#ifdef FlagShip
#define GRAFTEMPO_ON .T.
#else
#define GRAFTEMPO_ON .T.
#endif
#define GRAFMODE 1
#define GRAFTIME 2
#define GRAF_MARCACAO "I" // Chr(30) nao aparece no Linux
#define GRAF_TXT_BAR  1
#define GRAF_TXT_TEXT 2
#define GRAF_SEC_OLD  3
#define GRAF_SEC_INI  4

FUNCTION GrafProc( nRow, nCol )

   STATIC GrafInfo := { 1, "X" }
   LOCAL mSetDevice

   hb_Default( @nCol, MaxCol() - 2 )
   hb_Default( @nRow, MaxRow() - 1 )
   IF GrafInfo[ GRAFTIME ] != Left( Time(), 8 )
      mSetDevice := Set( _SET_DEVICE, "SCREEN" )
      @ nRow, nCol SAY "(" + Substr( "|/-\", GrafInfo[ GRAFMODE ], 1 ) + ")" COLOR SetColMensagem()
      GrafInfo[ GRAFMODE ] = iif( GrafInfo[ GRAFMODE ] == 4, 1, GrafInfo[ GRAFMODE ] + 1 )
      Set( _SET_DEVICE, mSetDevice )
      GrafInfo[ GRAFTIME ] := Left( Time(), 8 )
   ENDIF

   RETURN .T.

FUNCTION GrafTempo( xContNow, xContTotal )

   STATIC aStatic := { "", "", 0, 0 }
   LOCAL nSecNow, nSecRemaining, nSecElapsed, nCont, nPos, cTxt, cCorAnt
   LOCAL nPercent, cTexto, mSetDevice

   IF ! GRAFTEMPO_ON
      RETURN NIL
   ENDIF
   IF pCount() == 0
      xContNow := ""
   ENDIF
   IF Empty( aStatic[ GRAF_TXT_BAR ] )
      aStatic[ GRAF_TXT_BAR ] := Replicate( ".", MaxCol() )
      FOR nCont = 1 to 10
         nPos       := Int( Len( aStatic[ GRAF_TXT_BAR ] ) / 10 * nCont )
         cTxt       := lTrim( Str( nCont, 3 ) ) + "0%" + GRAF_MARCACAO
         aStatic[ GRAF_TXT_BAR ] := Stuff( aStatic[ GRAF_TXT_BAR ], ( nPos - Len( cTxt ) ) + 1, Len( cTxt ), cTxt )
      NEXT
      aStatic[ GRAF_TXT_BAR ] := GRAF_MARCACAO + aStatic[ GRAF_TXT_BAR ]
   ENDIF
   mSetDevice := Set( _SET_DEVICE, "SCREEN" )
   DO CASE
   CASE ValType( xContNow ) == "C"
      cTexto     := xContNow
      aStatic[ GRAF_SEC_INI ] := Int( Seconds() )
   CASE xContTotal == NIL
      nPercent := xContNow
   CASE xContNow >= xContTotal
      nPercent := 100
   OTHERWISE
      nPercent := xContNow / xContTotal * 100
   ENDCASE
   xContNow   := iif( ValType( xContNow ) != "N", 0, xContNow )
   xContTotal := iif( ValType( xContTotal ) != "N", 0, xContTotal )

   cCorAnt := SetColor()
   SetColor( SetColMensagem() )
   nSecNow := Int( Seconds() )
   IF nPercent == NIL
      aStatic[ GRAF_SEC_OLD ] := nSecNow
      Mensagem()
      @ MaxRow(), 0 SAY aStatic[ GRAF_TXT_BAR ]
      aStatic[ GRAF_TXT_TEXT ] := cTexto

   ELSEIF nPercent == 100 .OR. ( nSecNow != aStatic[ GRAF_SEC_OLD ] .AND. nPercent != 0 )
      aStatic[ GRAF_SEC_OLD ] := nSecNow
      nSecElapsed := nSecNow - aStatic[ GRAF_SEC_INI ]
      DO WHILE nSecElapsed < 0
         nSecElapsed += ( 24 * 3600 ) // Acima de 24 horas
      ENDDO
      nSecRemaining := nSecElapsed / nPercent * ( 100 - nPercent )
      @ MaxRow() - 1, 0 SAY aStatic[ GRAF_TXT_TEXT ] + " " + Ltrim( Transform( xContNow, "@E 999,999,999,999" ) ) + "/" + Ltrim( Transform( xContTotal, "@E 999,999,999,999" ) )
      cTxt := "Gasto:"
      cTxt += " " + Ltrim( Str( Int( nSecElapsed / 3600 ), 10 ) ) + "h"
      cTxt += " " + Ltrim( Str( Mod( Int( nSecElapsed / 60 ), 60 ), 10, 0 ) ) + "m"
      cTxt += " " + Ltrim( Str( Mod( nSecElapsed, 60 ), 10, 0 ) ) + "s"
      cTxt += Space(3)
      cTxt += "Falta:"
      cTxt += " " + Ltrim( Str( Int( nSecRemaining / 3600 ), 10 ) ) + "h"
      cTxt += " " + Ltrim( Str( Mod( Int( nSecRemaining / 60 ), 60 ), 10, 0 ) ) + "m"
      cTxt += " " + Ltrim( Str( Mod( nSecRemaining, 60 ), 10, 0 ) ) + "s"
      @ Row(), Col() SAY Padl( cTxt, MaxCol() - Col() - 3 )
      GrafProc()
      @ MaxRow(), 0 SAY Left( aStatic[ GRAF_TXT_BAR ], Len( aStatic[ GRAF_TXT_BAR ] ) * nPercent / 100 ) COLOR SetColFocus()
   ENDIF
   SetColor( cCorAnt )
   SET( _SET_DEVICE, mSetDevice )

   RETURN .T.
grafico.png
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

WVG / WVW - PROGRESS BAR - é possível?

Mensagem por JoséQuintas »

Remova o josequintas.ch, não sei se vai precisar dele.

Na dúvida, a primeira coisa a fazer é compilar ESSE fonte com -w3 -es2, assim já fica sabendo se falta alguma coisa.

hbmk2 essefonte.prg -w3 -es2
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

WVG / WVW - PROGRESS BAR - é possível?

Mensagem por JoséQuintas »

A direto pra Harbour, com teste e tudo, só compilar e executar.

Código: Selecionar todos

PROCEDURE Main

   LOCAL nCont

   SetMode(40,100)
   SetColor("W/B")
   CLS
   GrafTempo( "teste" )
   FOR nCont = 1 TO 100
      GrafTempo( nCont, 100 )
      Inkey(1)
   NEXT
   Inkey(0)

   RETURN

FUNCTION SetColorFocus(); RETURN "N/W"

FUNCTION PicVal(); RETURN "999,999"

FUNCTION SetColorMensagem(); RETURN "W/N"

FUNCTION Mensagem( cTexto )

   LOCAL cColorAnt

   hb_Default( @cTexto, "" )
   cColorAnt := SetColor( SetColorMensagem() )
   Scroll( MaxRow()-1, 0, MaxRow(), MaxCol(), 0 )
   @ MaxRow()-1, 0 SAY cTexto
   SetColor( cColorAnt )

   RETURN Nil

/*
ZE_GRAFTEMPO - GRAFICOS DE PROCESSAMENTO
1990.05 - José Quintas
*/

#include "inkey.ch"
#include "set.ch"

#define GRAFMODE 1
#define GRAFTIME 2
#define GRAF_SEC_OLD  1
#define GRAF_SEC_INI  2
#define GRAF_TXT_BAR  3
#define GRAF_TXT_TEXT 4

FUNCTION GrafProc( nRow, nCol )

   THREAD STATIC GrafInfo := { 1, "X" }
   LOCAL mSetDevice

   hb_Default( @nRow, MaxRow() - 1 )
   hb_Default( @nCol, MaxCol() - 2 )
   IF GrafInfo[ GRAFTIME ] != Time()
      mSetDevice := Set( _SET_DEVICE, "SCREEN" )
      @ nRow, nCol SAY "(" + Substr( "|/-\", GrafInfo[ GRAFMODE ], 1 ) + ")" COLOR SetColorMensagem()
      GrafInfo[ GRAFMODE ] = iif( GrafInfo[ GRAFMODE ] == 4, 1, GrafInfo[ GRAFMODE ] + 1 )
      Set( _SET_DEVICE, mSetDevice )
      GrafInfo[ GRAFTIME ] := Time()
   ENDIF

   RETURN .T.

FUNCTION GrafTempo( xContNow, xContTotal )

   THREAD STATIC aStatic := { 0, 0, "", "" }
   LOCAL nSecondsNow, nSecondsRemaining, nSecondsElapsed, nCont, nPos, cTxt, cCorAnt
   LOCAL nPercent, cTexto, mSetDevice

   xContNow := iif( xContNow == NIL, "", xContNow )
   IF Empty( aStatic[ GRAF_TXT_BAR ] )
      aStatic[ GRAF_TXT_BAR ] := Replicate( ".", MaxCol() )
      FOR nCont = 1 to 10
         nPos := Int( Len( aStatic[ GRAF_TXT_BAR ] ) / 10 * nCont )
         cTxt := lTrim( Str( nCont, 3 ) ) + "0%" + Chr(30)
         aStatic[ GRAF_TXT_BAR ] := Stuff( aStatic[ GRAF_TXT_BAR ], ( nPos - Len( cTxt ) ) + 1, Len( cTxt ), cTxt )
      NEXT
      aStatic[ GRAF_TXT_BAR ] := Chr(30) + aStatic[ GRAF_TXT_BAR ]
   ENDIF
   mSetDevice := Set( _SET_DEVICE, "SCREEN" )
   DO CASE
   CASE ValType( xContNow ) == "C"
      cTexto                  := xContNow
      aStatic[ GRAF_SEC_INI ] := Int( Seconds() )
   CASE xContTotal == NIL
      nPercent := xContNow
   CASE xContNow >= xContTotal
      nPercent := 100
   CASE xContTotal == 0
      nPercent := 0
   OTHERWISE
      nPercent := xContNow / xContTotal * 100
   ENDCASE
   xContNow   := iif( ValType( xContNow ) != "N", 0, xContNow )
   xContTotal := iif( ValType( xContTotal ) != "N", 0, xContTotal )

   cCorAnt := SetColor()
   SetColor( SetColorMensagem() )
   nSecondsNow := Int( Seconds() )
   IF nPercent == NIL
      aStatic[ GRAF_SEC_OLD ] := nSecondsNow
      Mensagem()
      @ MaxRow(), 0 SAY aStatic[ GRAF_TXT_BAR ]
      aStatic[ GRAF_TXT_TEXT ] := cTexto

   ELSEIF nPercent == 100 .OR. ( nSecondsNow != aStatic[ GRAF_SEC_OLD ] .AND. nPercent != 0 )
      aStatic[ GRAF_SEC_OLD ] := nSecondsNow
      nSecondsElapsed   := nSecondsNow - aStatic[ GRAF_SEC_INI ]
      DO WHILE nSecondsElapsed < 0
         nSecondsElapsed += ( 24 * 3600 ) // Acima de 24 horas
      ENDDO
      nSecondsRemaining := nSecondsElapsed / nPercent * ( 100 - nPercent )
      @ MaxRow()-1, 0 SAY aStatic[ GRAF_TXT_TEXT ] + " " + Ltrim( Transform( xContNow, PicVal(14,0) ) ) + "/" + Ltrim( Transform( xContTotal, PicVal(14,0) ) )
      cTxt := "Gasto:"
      cTxt += " " + Ltrim( Str( Int( nSecondsElapsed / 3600 ), 10 ) ) + "h"
      cTxt += " " + Ltrim( Str( Mod( Int( nSecondsElapsed / 60 ), 60 ), 10, 0 ) ) + "m"
      cTxt += " " + Ltrim( Str( Mod( nSecondsElapsed, 60 ), 10, 0 ) ) + "s"
      cTxt += Space(3)
      cTxt += "Falta:"
      cTxt += " " + Ltrim( Str( Int( nSecondsRemaining / 3600 ), 10 ) ) + "h"
      cTxt += " " + Ltrim( Str( Mod( Int( nSecondsRemaining / 60 ), 60 ), 10, 0 ) ) + "m"
      cTxt += " " + Ltrim( Str( Mod( nSecondsRemaining, 60 ), 10, 0 ) ) + "s"
      @ Row(), Col() SAY Padl( cTxt, MaxCol() - Col() - 4 )
      GrafProc()
      @ MaxRow(), 0 SAY Left( aStatic[ GRAF_TXT_BAR ], Len( aStatic[ GRAF_TXT_BAR ] ) * nPercent / 100 ) COLOR SetColorFocus()
   ENDIF
   SetColor( cCorAnt )
   SET( _SET_DEVICE, mSetDevice )

   RETURN .T.
grafico.png
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

WVG / WVW - PROGRESS BAR - é possível?

Mensagem por JoséQuintas »

Não sei se interessa...

HWGUI agora tem console também.

Vai ter que testar, mas acredito que possa ter facilidades pra misturar console e GUI.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
microvolution
Usuário Nível 5
Usuário Nível 5
Mensagens: 1231
Registrado em: 02 Set 2011 22:17
Contato:

WVG / WVW - PROGRESS BAR - é possível?

Mensagem por microvolution »

JoséQuintas escreveu:acredito que possa ter facilidades pra misturar console e GUI.
quanto à mesclagem, desenvolvemos uma alteração na HMG 3.5, a qual chamamos de HMG 3.5.0.1 onde é possível ter as 2 (consle + gui) funcionando perfeitamente num único sistema, usando HMG 3.5.0.1 + GTWVG.
JoséQuintas escreveu: HWGUI agora tem console também.
agradeço sempre sua honrosa atenção e ajuda em minhas indagações, dúvidas e anseios, mas, como estou pendurando a chuteira no clipper/harbour e partindo pra o mundo mobile, no momento, não interesso em aprender uma nova lib, não que num futuro a gente vá se interessar... mas, mesmo assim, me sinto honrado por sua ajuda, como sempre, sempre disponibilizando conhecimento a todos.
Nascimento escreveu:ja fiz em wvt, vou procurar baseado em um que tinha aqui no forum mesmo salvo engano
grato meu nobre. vou testar e assim que puder, lhes reportaremos.

No mais, agradecemos a todos! vamos testar, pois isso é apenas uma atualização num dos módulos externos (assim o chamo), pois o módulo (EXLUSAO.EXE) não mostra um andamento da exclusão - apesar de estar funcionando perfeitamente.
Grato,
MICROVOLUTION - 16 anos Evoluindo Com Você!


Você já leu a Bíblia hoje?
João 3:16 - Porque Deus amou ao mundo de tal maneira que deu seu Único Filho para que todo aquele que nEle crê não pereça mas tenha a Vida Eterna!
Responder