Página 2 de 2

como clicar sem clicar ????

Enviado: 17 Dez 2017 20:54
por asimoes
Pode tentar isso também:
Nesse caso não tem o on init da janela

ACTIVATE DIALOG oDlg ON ACTIVATE { || GERAARQUIVOS(), hwg_KEYB_EVENT( VK_END ) }

como clicar sem clicar ????

Enviado: 17 Dez 2017 21:08
por asimoes
Troca o VK_END po VK_ESCAPE

ACTIVATE DIALOG oDlg ON ACTIVATE { || GERAARQUIVOS(), hwg_KEYB_EVENT( VK_ESCAPE ) }

como clicar sem clicar ????

Enviado: 17 Dez 2017 21:36
por asimoes
Pronto acho que é isso que você quer:
Veja a função GERAARQUIVOS() vai te dar uma ideia como a barra corre

Código: Selecionar todos

#include "hwgui.ch"
************************************************************
FUNCTION abrearquivos(  )
************************************************************ 

  LOCAL oDlg,  oLabel1, oLabel2, oLabel3, oLabel4, oProgressbar1, oProgressbar2, oLabel5

  INIT DIALOG oDlg TITLE "Verificando Arquivos Aguarde..."    AT 0, 0 SIZE 656,208   ;
       STYLE WS_POPUP+WS_CAPTION+WS_SYSMENU+WS_SIZEBOX+DS_CENTER 
     
    ThisNFE := oDlg
 
   @ 14,18 SAY oLabel1 CAPTION "Arquivo:"  SIZE 55,18  
   @ 76,18 SAY oLabel2 CAPTION "nome do arquivo"  SIZE 566,18  
   @ 73,67 SAY oLabel4 CAPTION "nome do Indice"  SIZE 566,18  
   @ 15,66 SAY oLabel3 CAPTION "Indice:"  SIZE 45,18  
   @ 11,122 SAY oLabel5 CAPTION "Total:"  SIZE 45,18  
   @ 12,89 PROGRESSBAR oProgressbar1 SIZE 635,18  BARWIDTH 20 QUANTITY 100 
   @ 12,143 PROGRESSBAR oProgressbar2 SIZE 635,18  BARWIDTH 26 QUANTITY 100    
   
   ACTIVATE DIALOG oDlg ON ACTIVATE { || GERAARQUIVOS(), hwg_KEYB_EVENT( VK_ESCAPE ) }

RETURN oDlg:lresult

FUNCTION GERAARQUIVOS()
LOCAL I
   FOR I:=1 TO 10
      Eval( {|| ThisNFE:oProgressbar1:Set(, (i/10) * 100), ThisNFE:oProgressbar1:Refresh(), .T., hwg_DoEvents()} )
      Eval( {|| ThisNFE:oProgressbar2:Set(, (i/10) * 100), ThisNFE:oProgressbar2:Refresh(), .T., hwg_DoEvents()} )  
      InkeyGui(1)
   NEXT

RETURN Nil

#pragma BEGINDUMP

#include <windows.h>

#include "hbapi.h"

#include <olectl.h>

#include <time.h>

HB_FUNC( INKEYGUI )  
{                                                                      
    MSG Msg; 
    BOOL lNoLoop=FALSE; 
    UINT dwTimer, nRet=0, uTimeout=1, uMilisec=1000;   

    if( HB_ISNUM(1) ) uTimeout = hb_parni(1); 

    if( HB_ISNUM(2) ) uMilisec = hb_parni(2); 

    if( uTimeout==0 ) uTimeout = 0x0FFFFFFF; 

    if( uTimeout>0 ) uTimeout = uTimeout * uMilisec; 

    dwTimer = SetTimer( NULL, 0, uTimeout, NULL); 

    while( GetMessage(&Msg, NULL, 0, 0) ) 
    { 

       switch( Msg.message ) 
       { 
          case WM_KEYDOWN    : 
          case WM_SYSKEYDOWN : { nRet    = Msg.wParam; lNoLoop = TRUE; break; } 
          case WM_TIMER      : { lNoLoop = Msg.wParam == dwTimer;      break; } 
       } 
  
       if( lNoLoop ) 
       { 
          KillTimer( NULL, dwTimer ); 
          hb_retni( nRet ); 
          return ; 
       } 
       else  
       { 
          TranslateMessage( &Msg );  // Translates virtual key codes 
          DispatchMessage( &Msg );   // Dispatches message to window 
       }  
    } 
} 

#pragma ENDDUMP

como clicar sem clicar ????

Enviado: 18 Dez 2017 10:12
por asimoes

como clicar sem clicar ????

Enviado: 18 Dez 2017 10:33
por Fernando queiroz
tentei mas como disse antes o GERAARQUIVOS() acontece antes de aparecer a tela

ON ACTIVATE
ON INIT

ocorre antes da tela aparecer

como clicar sem clicar ????

Enviado: 18 Dez 2017 10:36
por Fernando queiroz

Código: Selecionar todos

#include "hwgui.ch"
************************************************************
FUNCTION abrearquivos(  )
************************************************************ 

  LOCAL oDlg,  oLabel1, oLabel2, oLabel3, oLabel4, oProgressbar1,  oLabel5, ThreadID
  PRIVATE oProgressbar2


 INIT DIALOG oDlg TITLE "Verificando Arquivos Aguarde..."    AT 0, 0 SIZE 656,208  ;
     	STYLE WS_POPUP+WS_CAPTION+WS_SYSMENU+WS_SIZEBOX+DS_CENTER 

   ThisNFE := oDlg
	
   
   @ 14,18 SAY oLabel1 CAPTION "Arquivo:"  SIZE 55,18  
   @ 76,18 SAY oLabel2 CAPTION "nome do arquivo"  SIZE 566,18  
   @ 73,67 SAY oLabel4 CAPTION "              "  SIZE 566,18  
   @ 15,66 SAY oLabel3 CAPTION "Indice:"  SIZE 45,18  
   @ 11,122 SAY oLabel5 CAPTION "Total:"  SIZE 45,18  
   @ 12,89 PROGRESSBAR oProgressbar1 SIZE 635,18  BARWIDTH 20 QUANTITY 100 
   @ 12,143 PROGRESSBAR oProgressbar2 SIZE 635,18  BARWIDTH 26 QUANTITY 100 
		
	
	ACTIVATE DIALOG oDlg ON ACTIVATE { || GERAARQUIVOS(), hwg_KEYB_EVENT( VK_ESCAPE ) }

	
RETURN 	NIL






******************************************
STATIC FUNCTION GERAARQUIVOS()
******************************************
	InkeyGui(1)


	Eval( {|| ThisNFE:oProgressbar2:Set(, 4), ThisNFE:oProgressbar2:Refresh(), .T., hwg_DoEvents()} )
  	ThisNFE:oLabel2:SetText("CAIXA")
	ABRE_CAIXA()
	USE

	
	Eval( {|| ThisNFE:oProgressbar2:Set(, 8), ThisNFE:oProgressbar2:Refresh(), .T., hwg_DoEvents()} )
 	ThisNFE:oLabel2:SetText("PRODUTOS")
	ABRE_PRODUTOS()
	USE

	
	Eval( {|| ThisNFE:oProgressbar2:Set(, 12), ThisNFE:oProgressbar2:Refresh(), .T., hwg_DoEvents()} )
 	ThisNFE:oLabel2:SetText("CLIENTES")
	ABRE_CLIENTES()
	USE

	
	Eval( {|| ThisNFE:oProgressbar2:Set(, 16), ThisNFE:oProgressbar2:Refresh(), .T., hwg_DoEvents()} )
 	ThisNFE:oLabel2:SetText("FORNECEDOR")
	ABRE_FORNECEDOR()
	USE

	
	Eval( {|| ThisNFE:oProgressbar2:Set(,20), ThisNFE:oProgressbar2:Refresh(), .T., hwg_DoEvents()} )
	ThisNFE:oLabel2:SetText("FORPRO")
	ABRE_FORPRO()
	USE
	
	Eval( {|| ThisNFE:oProgressbar2:Set(, 24), ThisNFE:oProgressbar2:Refresh(), .T., hwg_DoEvents()} )
	ThisNFE:oLabel2:SetText("VENDEDOR")
	ABRE_VENDEDOR()
	USE
	
//	ThisNFE:oProgressbar2:Set(,28)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("PEDIDO")
	ABRE_PEDIDO()
	USE
	
//	ThisNFE:oProgressbar2:Set(,32)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("ENTRADA")
	ABRE_ENTRADA()
	USE
	
//	ThisNFE:oProgressbar2:Set(,36)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("ORCAMENTO")	
	ABRE_ORCAMENTO()
	USE
	
//	ThisNFE:oProgressbar2:Set(,42)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("LOGGERAL")
	ABRE_LOG()
	USE
	
//	ThisNFE:oProgressbar2:Set(,46)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("RECEBER")
	ABRE_RECEBER()
	USE
	
//	ThisNFE:oProgressbar2:Set(,50)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("PAGAR")	
	ABRE_PAGAR()
	USE
	
//	ThisNFE:oProgressbar2:Set(,54)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("MOVCAIXA")	
	ABRE_MOVCAIXA()
	USE
	
//	ThisNFE:oProgressbar2:Set(,60)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("ITENS")	
	ABRE_ITENS(SUBSTR(DTOS(M->DAT_HOJE),3,6))
	USE
	
//	ThisNFE:oProgressbar2:Set(,64)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("CFOP")
	ABRE_CFOP()
	USE
	
//	ThisNFE:oProgressbar2:Set(,68)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("SERVICO")	
	ABRE_SERVICO()
	USE
	
//	ThisNFE:oProgressbar2:Set(,70)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("PECAS")	
	ABRE_PECAS(SUBSTR(DTOS(M->DAT_HOJE),3,6))
	USE
	
//	ThisNFE:oProgressbar2:Set(,74)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("NCM")
	ABRE_NCM()
	USE
	
//	ThisNFE:oProgressbar2:Set(,78)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("MUNICIPIOS")
	ABRE_MUNIC()
	USE
	
//	ThisNFE:oProgressbar2:Set(,82)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("LEMBRETE")
	ABRE_LEMBRETE()
	USE
	
//	ThisNFE:oProgressbar2:Set(,86)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("VENCIMENTO DE PRODUTOS")	
	ABRE_VENCIM()
	USE	
	
//	ThisNFE:oProgressbar2:Set(,90)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("NOTA FISCAL ELETRONICA")
	ABRE_NFE()
	USE
	
//	ThisNFE:oProgressbar2:Set(,92)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("ITENS DA NOTA FISCAL ELETRONICA")
	ABRE_NFEITEM()
	USE
	
//	ThisNFE:oProgressbar2:Set(,94)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("NOTA FISCAL AO CONSUMIDOR ELETRONICA")
	ABRE_NFCE()
	USE
	
//	ThisNFE:oProgressbar2:Set(,98)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("ITENS NOTA FISCAL AO CONSUMIDOR ELETRONICA")
	ABRE_NFCEITEM()
	USE
	
//	ThisNFE:oProgressbar2:Set(,100)
//	ThisNFE:oProgressbar2:increment()
//	ThisNFE:oLabel2:SetText("CERTIFICADO DIGITAL")
	ABRE_CERTIFICADO()
	USE

RETURN 

#pragma BEGINDUMP

#include "hbapi.h"

HB_FUNC( INKEYGUI )  
{                                                                      
    MSG Msg; 
    BOOL lNoLoop=FALSE; 
    UINT dwTimer, nRet=0, uTimeout=1, uMilisec=1000;   

    if( HB_ISNUM(1) ) uTimeout = hb_parni(1); 

    if( HB_ISNUM(2) ) uMilisec = hb_parni(2); 

    if( uTimeout==0 ) uTimeout = 0x0FFFFFFF; 

    if( uTimeout>0 ) uTimeout = uTimeout * uMilisec; 

    dwTimer = SetTimer( NULL, 0, uTimeout, NULL); 

    while( GetMessage(&Msg, NULL, 0, 0) ) 
    { 

       switch( Msg.message ) 
       { 
          case WM_KEYDOWN    : 
          case WM_SYSKEYDOWN : { nRet    = Msg.wParam; lNoLoop = TRUE; break; } 
          case WM_TIMER      : { lNoLoop = Msg.wParam == dwTimer;      break; } 
       } 
  
       if( lNoLoop ) 
       { 
          KillTimer( NULL, dwTimer ); 
          hb_retni( nRet ); 
          return ; 
       } 
       else  
       { 
          TranslateMessage( &Msg );  // Translates virtual key codes 
          DispatchMessage( &Msg );   // Dispatches message to window 
       }  
    } 
} 

#pragma ENDDUMP

FIZ ASSIM mas deu erro nessa parte de baixo

como clicar sem clicar ????

Enviado: 18 Dez 2017 10:37
por Fernando queiroz
ABREARQUIVOS.PRG: In function 'HB_FUN_INKEYGUI':
ABREARQUIVOS.PRG:210:5: error: unknown type name 'MSG'
ABREARQUIVOS.PRG:211:5: error: unknown type name 'BOOL'
ABREARQUIVOS.PRG:211:18: error: 'FALSE' undeclared (first use in this function)
ABREARQUIVOS.PRG:211:18: note: each undeclared identifier is reported only once for each function it appears in
ABREARQUIVOS.PRG:212:5: error: unknown type name 'UINT'
ABREARQUIVOS.PRG:222:15: warning: implicit declaration of function 'SetTimer' [-Wimplicit-function-declaration]
ABREARQUIVOS.PRG:224:12: warning: implicit declaration of function 'GetMessage' [-Wimplicit-function-declaration]
ABREARQUIVOS.PRG:227:19: error: request for member 'message' in something not a structure or union
ABREARQUIVOS.PRG:229:16: error: 'WM_KEYDOWN' undeclared (first use in this function)
ABREARQUIVOS.PRG:230:16: error: 'WM_SYSKEYDOWN' undeclared (first use in this function)
ABREARQUIVOS.PRG:230:47: error: request for member 'wParam' in something not a structure or union
ABREARQUIVOS.PRG:230:66: error: 'TRUE' undeclared (first use in this function)
ABREARQUIVOS.PRG:231:16: error: 'WM_TIMER' undeclared (first use in this function)
ABREARQUIVOS.PRG:231:47: error: request for member 'wParam' in something not a structure or union
ABREARQUIVOS.PRG:236:11: warning: implicit declaration of function 'KillTimer' [-Wimplicit-function-declaration]
ABREARQUIVOS.PRG:242:11: warning: implicit declaration of function 'TranslateMessage' [-Wimplicit-function-declaration]
ABREARQUIVOS.PRG:243:11: warning: implicit declaration of function 'DispatchMessage' [-Wimplicit-function-declaration]
hbmk2[sgc]: Erro: Executando compilador C/C++. 1

como clicar sem clicar ????

Enviado: 18 Dez 2017 10:56
por Fernando queiroz
porque a tela nao aparece comigo, nao estou entendendo

uso a HWGUI 2.20 :% :% :% :%

como clicar sem clicar ????

Enviado: 18 Dez 2017 10:57
por asimoes
Meus testes foram com a 2.17

como clicar sem clicar ????

Enviado: 18 Dez 2017 11:00
por asimoes
Outra coisa tá faltando na função InkeyGui:

#include <windows.h>
#include "hbapi.h"
#include <olectl.h>
#include <time.h>

como clicar sem clicar ????

Enviado: 18 Dez 2017 11:55
por Itamar M. Lins Jr.
Ola!
Com 2.20 sem nada! Lembrem-se do Dialog NOMODAL!, Tem um BUG, via oDlg:bActivate:= {||oDlg:Show(), geraarquivos(oDlg)}, faz o gráfico(mostra) mas não mostra os outros componentes, oLabel, OwnerButton... Vou reportar isso para o Kresin, mas um BUG esperando correção.

Código: Selecionar todos

#include "hwgui.ch"
FUNCTION MAIN
ABREARQUIVOS()
RETURN NIL

************************************************************
FUNCTION abrearquivos(  )
************************************************************ 

  LOCAL oDlg,  oLabel1, oLabel2, oLabel3, oLabel4, oProgressbar1, oProgressbar2, oLabel5, nomodal:=.T.

  INIT DIALOG oDlg TITLE "Verificando Arquivos Aguarde..."    AT 0, 0 SIZE 656,208  
     
   
   @ 580,177 OWNERBUTTON oOwnerbutton1  SIZE 68,28 ;
        TEXT 'Sair'  ;
        COORDINATES 0, 0, 0, 0  ;
        ON CLICK {|| oDlg:Close() }
   
   @ 14,18 SAY oLabel1 CAPTION "Arquivo:"  SIZE 55,18  
   @ 76,18 SAY oLabel2 CAPTION "nome do arquivo"  SIZE 566,18  
   @ 73,67 SAY oLabel4 CAPTION "nome do Indice"  SIZE 566,18  
   @ 15,66 SAY oLabel3 CAPTION "Indice:"  SIZE 45,18  
   @ 11,122 SAY oLabel5 CAPTION "Total:"  SIZE 45,18  
   @ 12,89 PROGRESSBAR oProgressbar1 SIZE 635,18  BARWIDTH 20 QUANTITY 100 
   @ 12,143 PROGRESSBAR oProgressbar2 SIZE 635,18  BARWIDTH 26 QUANTITY 100    

   //oDlg:bActivate :=  {||oDlg:Show(),GeraArquivos(oDlg) } aqui funciona parcialmente :-(
   oDlg:Activate(nomodal,,,.T.)

GERAARQUIVOS(oDlg)
oDlg:Close()

RETURN oDlg:lresult

FUNCTION GERAARQUIVOS(oDlg)
LOCAL I
   FOR I:=1 TO 10
      Eval( {|| oDlg:oProgressbar1:Set(, (i/10) * 100), oDlg:oProgressbar1:Refresh(), .T.} )
      Eval( {|| oDlg:oProgressbar2:Set(, (i/10) * 100), oDlg:oProgressbar2:Refresh(), .T.} )  
      inkey(.1)
   NEXT

RETURN Nil

Saudações,
Itamar M. Lins Jr.

como clicar sem clicar ????

Enviado: 31 Ago 2018 15:21
por Fernando queiroz
:)) :)) :)) :)) :)) :)) :))

COM a atualizacao da HWGUI 2.20 o problema foi resolvido

oBar := HProgressBar():NewBox( "Verificando Arquivos ...",183,0,423,70, 20,28 )
oBar:Step()
oBar:SetLabel("CAIXA")
ABRE_CAIXA()
USE

o METHOD :NEWBOX cria a janela e faz tudo certinho

:{ :{ :{ :{ :{ :{ :{