lecojales Posted June 10, 2011 Report Share Posted June 10, 2011 Gostaria que o foco ficasse em oPesq:SetFocus() , mas ao mostrar a janela não fica. *----------------------------------------------------------- static Function MostraClie(lModo,oWndFol) Local oDlgPesq,oBrwPesq,lSel:=.F. Local nOrdCli:=Clientes->(IndexOrd()),nRegCli:=Clientes->(RecNo()) Local oPesq,cPesq:=Space(40),oOrdem,nOrdem:=2,nKey DbSelectArea("Clientes") Clientes->(DbSetOrder(2)) Clientes->(DbGoTop()) DEFINE DIALOG oDlgPesq RESOURCE "PESQUISAS" OF oWndFol Redefine ListBox oBrwPesq Fields Clientes->CODIGO, Clientes->RAZAO_SOC,substr(Clientes->RAZAO_SOC,21,20),Clientes->Cidade ; Headers "Codigo" ,"Nome" ,"SobreNome" ,"Cidade" ID 49 Of oDlgPesq On DblCLick (lSel:=.T.,oDlgPesq:End()) oBrwPesq:bKeyChar:={|nKey| _Pesq("CL",nKey, oPesq,@cPesq,nOrdem,oBrwPesq)} Redefine Radio oOrdem Var nOrdem ID 48,50 of oDlgPesq On Change _MudaOrdem("CL",oBrwPesq,nOrdem,oPesq) Redefine Get oPesq VAR cPesq ID 47 Pict "@!" of oDlgPesq On Change _Pesq("CL",@nKey,oPesq,@cPesq,nOrdem,oBrwPesq) REDEFINE BUTTON oBtn1 ID 206 OF oDlgPesq ACTION (lSel:=.T.,oDlgPesq:End()) REDEFINE BUTTON ID 51 OF oDlgPesq ACTION DetCLientes() REDEFINE BUTTON ID 207 OF oDlgPesq ACTION oDlgPesq:End() If lModo obtn1:SetText("&Sair") End oPesq:SetFocus() ACTIVATE DIALOG oDlgPesq On Init oDlgPesq:Move(0,0) If lSel .And. !lModo oCodCli:VarPut(Clientes->CODIGO) oNomCli:VarPut(Clientes->RAZAO_SOC) oNomCli:Refresh() oCodCli:Refresh() oNumNf:SetFocus() End Return .T. id=code>id=code> Leco Jales Five PPC Harbour 1.0.1 - 1999-2008 Editado por - lecojales on 10/06/2011 15:56:03 Quote Link to comment Share on other sites More sharing options...
lecojales Posted June 10, 2011 Author Report Share Posted June 10, 2011 Gostaria que o foco ficasse em oPesq:SetFocus() , mas ao mostrar a janela não fica. *----------------------------------------------------------- static Function MostraClie(lModo,oWndFol) Local oDlgPesq,oBrwPesq,lSel:=.F. Local nOrdCli:=Clientes->(IndexOrd()),nRegCli:=Clientes->(RecNo()) Local oPesq,cPesq:=Space(40),oOrdem,nOrdem:=2,nKey DbSelectArea("Clientes") Clientes->(DbSetOrder(2)) Clientes->(DbGoTop()) DEFINE DIALOG oDlgPesq RESOURCE "PESQUISAS" OF oWndFol Redefine ListBox oBrwPesq Fields Clientes->CODIGO, Clientes->RAZAO_SOC,substr(Clientes->RAZAO_SOC,21,20),Clientes->Cidade ; Headers "Codigo" ,"Nome" ,"SobreNome" ,"Cidade" ID 49 Of oDlgPesq On DblCLick (lSel:=.T.,oDlgPesq:End()) oBrwPesq:bKeyChar:={|nKey| _Pesq("CL",nKey, oPesq,@cPesq,nOrdem,oBrwPesq)} Redefine Radio oOrdem Var nOrdem ID 48,50 of oDlgPesq On Change _MudaOrdem("CL",oBrwPesq,nOrdem,oPesq) Redefine Get oPesq VAR cPesq ID 47 Pict "@!" of oDlgPesq On Change _Pesq("CL",@nKey,oPesq,@cPesq,nOrdem,oBrwPesq) REDEFINE BUTTON oBtn1 ID 206 OF oDlgPesq ACTION (lSel:=.T.,oDlgPesq:End()) REDEFINE BUTTON ID 51 OF oDlgPesq ACTION DetCLientes() REDEFINE BUTTON ID 207 OF oDlgPesq ACTION oDlgPesq:End() If lModo obtn1:SetText("&Sair") End oPesq:SetFocus() ACTIVATE DIALOG oDlgPesq On Init oDlgPesq:Move(0,0) If lSel .And. !lModo oCodCli:VarPut(Clientes->CODIGO) oNomCli:VarPut(Clientes->RAZAO_SOC) oNomCli:Refresh() oCodCli:Refresh() oNumNf:SetFocus() End Return .T. id=code>id=code> Leco Jales Five PPC Harbour 1.0.1 - 1999-2008 Editado por - lecojales on 10/06/2011 15:56:03 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 10, 2011 Report Share Posted June 10, 2011 Procure por XFOCUS João Santos - São Paulo. kmt_karinha@pop.com.br joao@pleno.com.br Fone: (11) 3106-2832 / 8243-5632 - TIM FWH 2.7 - xHARBOUR WorkShop.Exe Quote Link to comment Share on other sites More sharing options...
lecojales Posted June 10, 2011 Author Report Share Posted June 10, 2011 Achei e estou usando assim: xFocus(oPesq) Mas não funcionou não. no forum está assim as rotinas *------------------------------------------------------------------------------- FUNCTION xSetFocus( oObj ) LOCAL _oWnd := oObj:oWnd, _oTempo := "" DEFINE Timer _oTempo Interval 10 of _oWnd ; Action ( oObj:SetFocus(), _oTempo:End() ) ACTIVATE Timer _oTempo RETURN( .T. ) *------------------------------------------------------------------------------- FUNCTION xFocus( oObj ) xSetFocus( oObj ) xSetFocus( oObj ) RETURN( .T. ) id=code>id=code>Five PPC Harbour 1.0.1 - 1999-2008 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 10, 2011 Report Share Posted June 10, 2011 PRIVATE oPesq João Santos - São Paulo. kmt_karinha@pop.com.br joao@pleno.com.br Fone: (11) 3106-2832 / 8243-5632 - TIM FWH 2.7 - xHARBOUR WorkShop.Exe Quote Link to comment Share on other sites More sharing options...
lecojales Posted June 10, 2011 Author Report Share Posted June 10, 2011 Ainda não deu certo. Está assim, com xfocus, e private no opesq: *------------------------------------------------------------------------------- Static Function MostraClie(lModo,oWndFol) Local oDlgPesq,oBrwPesq,lSel:=.F. Local nOrdCli:=Clientes->(IndexOrd()),nRegCli:=Clientes->(RecNo()) Local cPesq:=Space(40),oOrdem,nOrdem:=2,nKey Private oPesq DbSelectArea("Clientes") Clientes->(DbSetOrder(2)) Clientes->(DbGoTop()) DEFINE DIALOG oDlgPesq RESOURCE "PESQUISAS" OF oWndFol Redefine ListBox oBrwPesq Fields Clientes->CODIGO, Clientes->RAZAO_SOC,substr(Clientes->RAZAO_SOC,21,20),Clientes->Cidade ; Headers "Codigo" ,"Nome" ,"SobreNome" ,"Cidade" ID 49 Of oDlgPesq On DblCLick (lSel:=.T.,oDlgPesq:End()) oBrwPesq:bKeyChar:={|nKey| _Pesq("CL",nKey, oPesq,@cPesq,nOrdem,oBrwPesq)} Redefine Radio oOrdem Var nOrdem ID 48,50 of oDlgPesq On Change _MudaOrdem("CL",oBrwPesq,nOrdem,oPesq) Redefine Get oPesq VAR cPesq ID 47 Pict "@!" of oDlgPesq On Change _Pesq("CL",@nKey,oPesq,@cPesq,nOrdem,oBrwPesq) REDEFINE BUTTON oBtn1 ID 206 OF oDlgPesq ACTION (lSel:=.T.,oDlgPesq:End()) REDEFINE BUTTON ID 51 OF oDlgPesq ACTION DetCLientes() REDEFINE BUTTON ID 207 OF oDlgPesq ACTION oDlgPesq:End() If lModo obtn1:SetText("&Sair") End xFocus(oPesq) ACTIVATE DIALOG oDlgPesq On Init oDlgPesq:Move(0,0) If lSel .And. !lModo oCodCli:VarPut(Clientes->CODIGO) oNomCli:VarPut(Clientes->RAZAO_SOC) oNomCli:Refresh() oCodCli:Refresh() oNumNf:SetFocus() End Return .T. id=code>id=code>Five PPC Harbour 1.0.1 - 1999-2008 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 10, 2011 Report Share Posted June 10, 2011 Redefine Get oPesq VAR cPesq ID 47 Pict "@!" of oDlgPesq On Change _Pesq("CL",@nKey,oPesq,@cPesq,nOrdem,oBrwPesq) id=code>id=code>ON CHANGE??? NÃO SERIA VALID(... João Santos - São Paulo. kmt_karinha@pop.com.br joao@pleno.com.br Fone: (11) 3106-2832 / 8243-5632 - TIM FWH 2.7 - xHARBOUR WorkShop.Exe Quote Link to comment Share on other sites More sharing options...
lecojales Posted June 10, 2011 Author Report Share Posted June 10, 2011 Acho que não, pois uso a mesma rotina para pesquizar o produto e o cliente. Leco Jales Five PPC Harbour 1.0.1 - 1999-2008 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 10, 2011 Report Share Posted June 10, 2011 citação:Acho que não, pois uso a mesma rotina para pesquizar o produto e o cliente. Leco Jales Five PPC Harbour 1.0.1 - 1999-2008 id=quote>id=quote>TENTE COM O VALID, RETORNE .T. OU .F. João Santos - São Paulo. kmt_karinha@pop.com.br joao@pleno.com.br Fone: (11) 3106-2832 / 8243-5632 - TIM FWH 2.7 - xHARBOUR WorkShop.Exe Quote Link to comment Share on other sites More sharing options...
leandroptu Posted June 10, 2011 Report Share Posted June 10, 2011 Olá Tente assim: xSetFocus(oPesq) Assim funciona no meu. Fivewin 8.12 + XHarbour Build 1.1.0 + WorkShop + vLib + SqlLib + MySQL 5.0.27 + xDev Studio + FWPPC E-mail: leandrolopes@success.inf.br Msn: leandroptu@ada.com.br Paracatu/MG Quote Link to comment Share on other sites More sharing options...
lecojales Posted June 10, 2011 Author Report Share Posted June 10, 2011 Kabiaba, não dá, pois conforme vai digitando já vai pesquizando, por isso não posso usar a clausula valid. Leco Jales Five PPC Harbour 1.0.1 - 1999-2008 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 10, 2011 Report Share Posted June 10, 2011 POSTE _PESQ João Santos - São Paulo. kmt_karinha@pop.com.br joao@pleno.com.br Fone: (11) 3106-2832 / 8243-5632 - TIM FWH 2.7 - xHARBOUR WorkShop.Exe Quote Link to comment Share on other sites More sharing options...
lecojales Posted June 10, 2011 Author Report Share Posted June 10, 2011 *------------------------------------------------------------------------------- Static Function _Pesq(cModulo,nKey,oPesq,cPesq,nOrdem,oBrwPesq) Local lRet:=.T. if nKey == 8 cPesq = SubStr( cPesq, 1, Len( cPesq ) - 1 ) else cPesq += Upper( Chr( nKey ) ) endif oPesq:VarPut(cPesq) oPesq:Refresh() If nOrdem==1 If cModulo=="CL" If !Clientes->(Dbseek(StrZero(Val(cPesq),6))) MsgInfo("Cliente não encontrado no cadastro, verifique o código...","Clientes") lRet:=.F. End Else If !Produtos->(Dbseek(StrZero(Val(cPesq),10))) MsgInfo("Produto não encontrado no cadastro, verifique o código...","Produtos") lRet:=.F. End if substr(Produtos->nome,1,2) == "ZZ" MsgInfo("Produto INATIVO!!!","Produtos") lRet:=.F. End End Else If cModulo=="CL" Clientes->(Dbseek(AllTrim(cPesq),.t.)) Else Produtos->(Dbseek(AllTrim(cPesq),.t.)) End End oBrwPesq:Refresh() ///oBrwPesq:SetFocus() oPesq:SetFocus() Return lRet id=code>id=code>Five PPC Harbour 1.0.1 - 1999-2008 Quote Link to comment Share on other sites More sharing options...
lecojales Posted June 10, 2011 Author Report Share Posted June 10, 2011 Pessoal resolvi a questão do foco: eu chamava assim: ACTIVATE DIALOG oDlgPesq On Init oDlgPesq:Move(0,0) passei a chamar assim: ACTIVATE DIALOG oDlgPesq On Init oDlgPesq:Move(0,0) On Paint oPesq:SetFocus() Leco Jales Five PPC Harbour 1.0.1 - 1999-2008 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.