Jmsilva Posted August 20, 2014 Report Share Posted August 20, 2014 Veja o código abaixo, tem três GET(oGde) e dois BTNBMP (Salvar e excluir). Preciso que ao teclar ENTER ou Click com o mouse no botão oBtnW (gravar) que após gravar o foco volte ao primeiro get (oGde[1]), na tela não postei mas tem browse tb, com o código abaixo se usar o mouse faz corretamente, grava informação, faz refresh() no browse e o foco fica primeiro get (oGde[1]), mas com a tecla ENTER faz a gravação, refreh() no browse mas o focu vai o botão de excluir (oBtnE). O uso da tecla enter agiliza a digitação (maior rapidez). blz. JMSILVA Caraguatatuba/SP **--------- @ 5.69, 13.0 GET oGde[1] VAR cCODES OF oFld:aDialogs[3]; SIZE 92,09 FONT oFnt[4]; PICTURE "@!" ACTION Q_TABOCO(oWnd) BITMAP "pwd\find.bmp"; VALID F_PESQCD() WHEN lPRG UPDATE //oGt[6]:bChange := {|nKEY,y,xGET| VA->NS := xGET:cText} @ 6.60, 13.0 GET oGde[2] VAR nQTDE OF oFld:aDialogs[3]; SIZE 32,09 FONT oFnt[4]; PICTURE "9999999999" IF !lPRG oGde[2]:bWhen := {|| .F.} Endif @ 6.60, 20.5 GET oGde[3] VAR cDEN OF oFld:aDialogs[3]; SIZE 32,09 FONT oFnt[4]; PICTURE "@R 999999/99" RIGHT; VALID (cDEN:=StrZero(Val(cDEN),8),oGde[3]:Refresh(),.T.); WHEN (lPRG .and. AScan(CH_IDDENUN,SubStr(cCODES,1,3)) > 0) @ 79, 206 BTNBMP oBtnW OF oFld:aDialogs[3] 2007; FILE "pwd\level3.bmp" SIZE 15, 15 UPDATE; TOOLTIP "Grava a dados"; ACTION (GRAVA_DE(), oBrDE:Refresh(),; cCODES:=Space(20),nQTDE:=0,cDEN:=Space(8),; oGde[3]:Refresh(),oGde[2]:Refresh(),oGde[1]:Refresh(),; oGde[1]:SetFocus(.t.)) @ 79, 230 BTNBMP oBtnE OF oFld:aDialogs[3] 2007; FILE "pwd\level1.bmp" SIZE 15, 15 UPDATE; TOOLTIP "Exclui registro"; ACTION EXCLUI_DE() Quote Link to comment Share on other sites More sharing options...
aferra Posted August 20, 2014 Report Share Posted August 20, 2014 é só um palpite no final do action do botão acrescente oBtnW:SetFocus(),oGde[1]:SetFocus(.t.) Quote Link to comment Share on other sites More sharing options...
Jmsilva Posted August 20, 2014 Author Report Share Posted August 20, 2014 é só um palpite no final do action do botão acrescente oBtnW:SetFocus(),oGde[1]:SetFocus(.t.) Se for isso, @ 79, 206 BTNBMP oBtnW OF oFld:aDialogs[3] 2007; FILE "pwd\level3.bmp" SIZE 15, 15 UPDATE; TOOLTIP "Grava a dados"; ACTION (GRAVA_DE(), oBrDE:Refresh(),; cCODES:=Space(20),nQTDE:=0,cDEN:=Space(8),; oGde[3]:Refresh(),oGde[2]:Refresh(),oGde[1]:Refresh(),; oBtnW:SetFocus(),oGde[1]:SetFocus(.t.)) Não funcionou.... Quote Link to comment Share on other sites More sharing options...
kapiaba Posted August 20, 2014 Report Share Posted August 20, 2014 Tente assim: @ 79, 206 BTNBMP oBtnW OF oFld:aDialogs[3] 2007; FILE "pwd\level3.bmp" SIZE 15, 15 UPDATE; TOOLTIP "Grava a dados"; ACTION ( ( GRAVA_DE() ), oBrDE:Refresh(), ; cCODES:=Space(20),nQTDE:=0,cDEN:=Space(8),; oGde[3]:Refresh(),oGde[2]:Refresh(),oGde[1]:Refresh(),; oGde[1]:SetFocus(),oGde[1]:SetFocus(.t.) ) Quote Link to comment Share on other sites More sharing options...
Jmsilva Posted August 20, 2014 Author Report Share Posted August 20, 2014 Tente assim: @ 79, 206 BTNBMP oBtnW OF oFld:aDialogs[3] 2007; FILE "pwd\level3.bmp" SIZE 15, 15 UPDATE; TOOLTIP "Grava a dados"; ACTION ( ( GRAVA_DE() ), oBrDE:Refresh(), ; cCODES:=Space(20),nQTDE:=0,cDEN:=Space(8),; oGde[3]:Refresh(),oGde[2]:Refresh(),oGde[1]:Refresh(),; oGde[1]:SetFocus(),oGde[1]:SetFocus(.t.) ) Não funcionou tb. Quote Link to comment Share on other sites More sharing options...
Theotokos Posted August 20, 2014 Report Share Posted August 20, 2014 para direcionar o foco em um objeto eu uso esta função : FUNCTION xSetFocus( oObj ) xFocus( oObj ) xFocus( oObj ) RETURN( .T. ) FUNCTION xFocus( oObj ) LOCAL _oWnd := oObj:oWnd, _oTempo := "" DEFINE Timer _oTempo Interval 10 of _oWnd ; Action ( oObj:SetFocus(),_oTempo:End() ) ACTIVATE Timer _oTempo RETURN( .T. ) Quote Link to comment Share on other sites More sharing options...
sambomb Posted August 20, 2014 Report Share Posted August 20, 2014 @ 79, 206 BTNBMP oBtnW OF oFld:aDialogs[3] 2007; FILE "pwd\level3.bmp" SIZE 15, 15 UPDATE; TOOLTIP "Grava a dados"; ACTION ClickBotao() Function ClickBotao() Local oDlgPause GRAVA_DE() oBrDE:Refresh() cCODES:=Space(20) nQTDE:=0 cDEN:=Space(8) oGde[1]:Refresh() oGde[2]:Refresh() oGde[3]:Refresh() DEFINE DIALOG oDlgPause; FROM -10,-10 TO 1, 1; STYLE nOr( DS_MODALFRAME, WS_POPUP ); OF oFld:aDialogs[3] oDlgPause:nTop := -20 oDlgPause:nLeft := -20 oDlgPause:bStart := { || Eval( { || WaitSeconds( 0.2 ) }, oDlgPause ), oDlgPause:End(), SysRefresh() } ACTIVATE DIALOG oDlgPause oDlgPause := Nil oGde[1]:SetFocus() Return Quote Link to comment Share on other sites More sharing options...
Jmsilva Posted August 20, 2014 Author Report Share Posted August 20, 2014 @ 79, 206 BTNBMP oBtnW OF oFld:aDialogs[3] 2007; FILE "pwd\level3.bmp" SIZE 15, 15 UPDATE; TOOLTIP "Grava a dados"; ACTION ClickBotao() Function ClickBotao() Local oDlgPause GRAVA_DE() oBrDE:Refresh() cCODES:=Space(20) nQTDE:=0 cDEN:=Space(8) oGde[1]:Refresh() oGde[2]:Refresh() oGde[3]:Refresh() DEFINE DIALOG oDlgPause; FROM -10,-10 TO 1, 1; STYLE nOr( DS_MODALFRAME, WS_POPUP ); OF oFld:aDialogs[3] oDlgPause:nTop := -20 oDlgPause:nLeft := -20 oDlgPause:bStart := { || Eval( { || WaitSeconds( 0.2 ) }, oDlgPause ), oDlgPause:End(), SysRefresh() } ACTIVATE DIALOG oDlgPause oDlgPause := Nil oGde[1]:SetFocus() Return Sua solução funcionou perfeitamente, valeu agora vou estudar este arranjo técnico. Show de bola obrigado a todos !!! Quote Link to comment Share on other sites More sharing options...
sambomb Posted August 20, 2014 Report Share Posted August 20, 2014 Fivewin tem uns bugs com foco em componente...O que eu fiz ae é criar uma tela que fica ativa só por 0.2 segundos e depois fecha sozinha, depois disso joga do foco para o componente que você quer.Você pode separar essa solução ae em uma função colocando o tempo e janela atual como parâmetros. Jmsilva 1 Quote Link to comment Share on other sites More sharing options...
SAOliveira Posted August 20, 2014 Report Share Posted August 20, 2014 Experimente ao final das funções. oBot[x]:oJump:=obj_que_você_quer Quote Link to comment Share on other sites More sharing options...
crisvam Posted August 21, 2014 Report Share Posted August 21, 2014 Veja o código abaixo, tem três GET(oGde) e dois BTNBMP (Salvar e excluir). Preciso que ao teclar ENTER ou Click com o mouse no botão oBtnW (gravar) que após gravar o foco volte ao primeiro get (oGde[1]), na tela não postei mas tem browse tb, com o código abaixo se usar o mouse faz corretamente, grava informação, faz refresh() no browse e o foco fica primeiro get (oGde[1]), mas com a tecla ENTER faz a gravação, refreh() no browse mas o focu vai o botão de excluir (oBtnE). O uso da tecla enter agiliza a digitação (maior rapidez). blz. JMSILVA Caraguatatuba/SP **--------- @ 5.69, 13.0 GET oGde[1] VAR cCODES OF oFld:aDialogs[3]; SIZE 92,09 FONT oFnt[4]; PICTURE "@!" ACTION Q_TABOCO(oWnd) BITMAP "pwd\find.bmp"; VALID F_PESQCD() WHEN lPRG UPDATE //oGt[6]:bChange := {|nKEY,y,xGET| VA->NS := xGET:cText} @ 6.60, 13.0 GET oGde[2] VAR nQTDE OF oFld:aDialogs[3]; SIZE 32,09 FONT oFnt[4]; PICTURE "9999999999" IF !lPRG oGde[2]:bWhen := {|| .F.} Endif @ 6.60, 20.5 GET oGde[3] VAR cDEN OF oFld:aDialogs[3]; SIZE 32,09 FONT oFnt[4]; PICTURE "@R 999999/99" RIGHT; VALID (cDEN:=StrZero(Val(cDEN),8),oGde[3]:Refresh(),.T.); WHEN (lPRG .and. AScan(CH_IDDENUN,SubStr(cCODES,1,3)) > 0) @ 79, 206 BTNBMP oBtnW OF oFld:aDialogs[3] 2007; FILE "pwd\level3.bmp" SIZE 15, 15 UPDATE; TOOLTIP "Grava a dados"; ACTION (GRAVA_DE(), oBrDE:Refresh(),; cCODES:=Space(20),nQTDE:=0,cDEN:=Space(8),; oGde[3]:Refresh(),oGde[2]:Refresh(),oGde[1]:Refresh(),; oGde[1]:SetFocus(.t.)) @ 79, 230 BTNBMP oBtnE OF oFld:aDialogs[3] 2007; FILE "pwd\level1.bmp" SIZE 15, 15 UPDATE; TOOLTIP "Exclui registro"; ACTION EXCLUI_DE() Vc tem mais de um botão com TAB_STOP ativo? ou o seu Browse Está com o TAB_STOP ativo? Para cada TAB_STOP ativo tem que ter um "Enter" adicional. 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.