Alain da Silva Posted June 30, 2016 Report Share Posted June 30, 2016 bom dia, porque isso acontece. REDEFINE BUTTONBMP oBtn[1] ID 28 OF ODLG1;; // botao editar ACTION (; ATIVAOBJ(OBJGRUPO,2),; HABILITASALVAR(oBtn[1],oBtn[2],oBtn[3],oBtn[4],oBtn[5]),; xSETFOCUS(OBJGRUPO[2]),; ) REDEFINE BUTTONBMP oBtn[2] ID 29 OF ODLG1; // botao salvar ACTION (; GRAVAGRU(OPCAO,oDlg1,OBJGRUPO,oBtn[1],oBtn[2],oBtn[3],oBtn[4],oBtn[5],@vargru[1]),; XSETFOCUS(OBTN[1]),; OBRW:GOTOP(),; OBRW:REFRESH(),; ) FUNCTION GRAVAGRU(OPCAO,OTELA,OOBJ,OBOTAO1,OBOTAO2,OBOTAO3,OBOTAO4,OBOTAO5,oVar) IF VARGRU[2]=" " MsgInfo("(*) Campo de Preenchimento Obrigatório","AVISO DE ALERTA") ICONFICAO:=.T. RETURN(.F.) ENDIF IF OPCAO="A".OR.OPCAO="I" IF (OPCAO=="A") DO WHILE !RLOCK() ENDDO ELSEIF (OPCAO=="I") DO INCREG2 ENDIF REPL CODIGO WITH VARGRU[1], NOME WITH VARGRU[2] UNLOCK DBCOMMIT() ENDIF IF OPCAO=="I" IF MSGYESNO("Deseja Continuar a Incluir?","CONFIRMA") VARGRU :={0,SPACE(50)} VARGRUant:={0,SPACE(50)} REFRESCARANT(OOBJ,VARGRU,VARGRUANT,2) SELE 13 DBSETORDER(1) GO BOTT VARGRU[1]:=ARQGRUPO->CODIGO+1 OOBJ[1]:REFRESH() XSETFOCUS(OOBJ[2]) ELSE saidlg:=.t. OTELA:END() ENDIF ELSE DESABILITASALVAR(OBOTAO1,OBOTAO2,OBOTAO3,OBOTAO4,OBOTAO5) DESABILITAOBJ(OOBJ,50) ENDIF return(.T.) O botão salvar esta desligado, eu ativo o botão na hora de salvar e dou um foco no botão editar de novo. Ai ele muda o botão de lugar. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 30, 2016 Report Share Posted June 30, 2016 Mostre o .RC para se ver se não tem ID diferente. Quote Link to comment Share on other sites More sharing options...
Alain da Silva Posted June 30, 2016 Author Report Share Posted June 30, 2016 MANUTGRUPO DIALOG 2, 99, 500, 156STYLE DS_ABSALIGN | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_MAXIMIZEBOXCAPTION "Fenix Sistem@s - Cadastro de Grupo de Produto"FONT 8, "MS Sans Serif"LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL{ PUSHBUTTON "Editar", 28, 7, 126, 50, 14 EDITTEXT 1, 18, 80, 422, 15, WS_BORDER | WS_TABSTOP PUSHBUTTON "Salvar", 29, 60, 126, 56, 14 PUSHBUTTON "Cancelar", 47, 120, 126, 56, 14 PUSHBUTTON "Excluir", 25, 179, 126, 50, 14 PUSHBUTTON "Retornar", 26, 231, 126, 56, 14 RTEXT "", 2, 444, 80, 44, 15, SS_RIGHT | WS_DISABLED | WS_BORDER | WS_GROUP LTEXT "Nome/Descrição *", -2, 18, 67, 74, 8 RTEXT "CÓDIGO", -3, 448, 69, 40, 8 GROUPBOX "DADOS DO GRUPO DE PRODUTO", -40, 8, 38, 487, 81, BS_GROUPBOX | BS_LEFTTEXT | WS_GROUP} Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 30, 2016 Report Share Posted June 30, 2016 Lendo o Caption, não me parece ser o mesmo dialogo. CAPTION "Fenix Sistem@s - Cadastro de Grupo de Produto" Quote Link to comment Share on other sites More sharing options...
Alain da Silva Posted June 30, 2016 Author Report Share Posted June 30, 2016 eu mudo na hora de mostrar. Esta acontecendo umas coisas estranhas também, eu tinha colocado o atalho no botão &Editar, acontece que na primeira vez ele fazia, depois que editada,salvava ele não funciona mais. Se eu sair do programa e voltar para o programa ele funciona. Tipo ele perde o foco depois volta. *----------- DEFINE A TELA ----------------------------* DEFINE DIALOG ODLGGRUPO RESOURCE "MANUTGRUPO" COLOR PRETO,CINZACL title "...: Manutenção Cadastro de Grupo de Produto...:"; STYLE nOr(WS_POPUP, ; WS_VISIBLE, ; WS_CAPTION) PIXEL ODLGGRUPO : LHELPICON := .F. // TIRA A ? DA JANELA ODLGGRUPO: bRClicked = { || MsgInfo( OemToAnsi( "Sem Efeito" ), ; ( OemToAnsi( "Informação" ) ) ) } *------------- Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 30, 2016 Report Share Posted June 30, 2016 Retire isso, isto é para @(credo) SAY STYLE nOr(WS_POPUP, ; WS_VISIBLE, ; WS_CAPTION) PIXEL Quote Link to comment Share on other sites More sharing options...
Alain da Silva Posted June 30, 2016 Author Report Share Posted June 30, 2016 Retirei ainda acontece a mudança de lugar. Mudei o nome do botão pra ver se era conflito e nada. É na hora do xsetfocus(). Será que tem alguma coisa errada: FUNCTION XSETFOCUS(OOBJ) LOCAL OTEMPO := "" DEFINE TIMER OTEMPO INTERVAL 10 OF OOBJ:OWND ACTION (OOBJ:SETFOCUS(),OOBJ:SETPOS(0),OTEMPO:DEACTIVATE()) ACTIVATE TIMER OTEMPO RETURN("") Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 30, 2016 Report Share Posted June 30, 2016 Me mostre como esta usando o XFOCUS(), xSetFocus() não deve ser invocado sózinho. Use o XFOCUS( oBtn ) //-------------------------------------------------------------------------// FUNCTION xFocus( oObj ) xSetFocus( oObj ) xSetFocus( oObj ) RETURN( .T. ) //-------------------------------------------------------------------------// 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. ) Quote Link to comment Share on other sites More sharing options...
Alain da Silva Posted June 30, 2016 Author Report Share Posted June 30, 2016 eu não uso xfocus, somente xsetfocus. REDEFINE BUTTONBMP oBtn[2] ID 29 OF ODLG1; // botao salvar ACTION (; GRAVAGRU(OPCAO,oDlg1,OBJGRUPO,oBtn[1],oBtn[2],oBtn[3],oBtn[4],oBtn[5],@vargru[1]),; XSETFOCUS(OBTN[1]),; OBRW:GOTOP(),; OBRW:REFRESH(),; ) como informei acima. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 30, 2016 Report Share Posted June 30, 2016 ????????????????? OTEMPO:DEACTIVATE() // destrua esse seu modelo ai, nunca vi. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 30, 2016 Report Share Posted June 30, 2016 O correto é assim: REDEFINE BUTTONBMP oBtn[2] ID 29 OF ODLG1; // botao salvar ACTION ( GRAVAGRU( OPCAO, oDlg1, OBJGRUPO, oBtn[1], oBtn[2], ; oBtn[3], oBtn[4], oBtn[5], @vargru[1]), ; OBRW:GOTOP(), OBRW:REFRESH(), ; XFOCUS(OBTN[1]) ) Destrua a sua função e use a minha que é a correta. Quote Link to comment Share on other sites More sharing options...
Alain da Silva Posted June 30, 2016 Author Report Share Posted June 30, 2016 fiz isso e funcionou. Obrigado Kapiaba. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted June 30, 2016 Report Share Posted June 30, 2016 fiz isso e funcionou. Obrigado Kapiaba. fiz isso e funcionou. Obrigado Kapiaba. Parabéns!! Fiquei feliz. 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.