Marca Posted March 7, 2017 Report Share Posted March 7, 2017 Bom dia a todos Me deparei com uma situação em meus gets q. contem imagens e acredito ser um bug relativamente preocupante REDEFINE GET oGetCont[1] VAR f_CodServ ID 200 OF oDlgEditContrato ; BITMAP 'Get_Dados' ; PICTURE "@!" ; ACTION (GetZoom( "Produto", oGetCont[1], oSayCont[1], 450,150 ),oGetCont[1]:Refresh() ) ; VALID Checa_Contratos("Produto",f_CodServ,oSayCont[1],.F.,1) .AND. !Empt(F_CodServ) REDEFINE GET oGetCont[8] VAR f_DtInicio ID 201 OF oDlgEditContrato ; BITMAP 'Get_Data' ; ACTION (aRec := GetCoors(oGetCont[8]:hWnd) ,; f_DtInicio := Calendario(f_DtInicio, aRec[1], aRec[4], oDlgEditContrato), oGetCont[8]:Refresh()) ; Valid(!Empt( f_DtInicio )) Observem q. tanto o oGetCont[1] quanto o oGetCont[8] tem valid neles E observem q. no caso do oGetCont[1] VALID Checa_Contratos("Produto",f_CodServ,oSayCont[1],.F.,1) .AND. !Empt(F_CodServ) Não era pra deixar passar vazio de jeito algum. Sendo que se eu clicar na figura do oGetCont[8] sem ter dado enter no oGetCont[1] ele vai pra este oGetCont[8] sem fazer nenhum tipo de critica. Alguém já se deparou com isso ? Quote Link to comment Share on other sites More sharing options...
kapiaba Posted March 7, 2017 Report Share Posted March 7, 2017 Nos botões tem BTNBMP? Mostre a função: [code Checa_Contratos( ) [/code] Quote Link to comment Share on other sites More sharing options...
Marca Posted March 7, 2017 Author Report Share Posted March 7, 2017 Nos botões tem BTNBMP? Mostre a função: [code Checa_Contratos( ) [/code] João A função se quer é executada no caso que descrevi. Este é o problema passa direto por ela. **************************************//*************************************** STATIC FUNCTION Checa_Contratos(cArqProc,nCod,oSay,lCont,nOp ) **************************************//*************************************** LOCAL cSqlSekCont LOCAL vSekContrato IF !Empty(nCod) IF nOp = 1 cSqlSekCont := "SELECT descricao FROM " + Lower(cArqProc) + " WHERE cod_est = " + ANY2SQL( nCod ) ELSEIF nOp = 3 .OR. nOp = 6 cSqlSekCont := "SELECT descricao FROM " + Lower(cArqProc) + " WHERE codigo = " + ANY2SQL( nCod ) ELSE cSqlSekCont := "SELECT nome FROM " + Lower(cArqProc) + " WHERE codigo = " + ANY2SQL( nCod ) ENDIF vSekContrato := GeraQuery( cSqlSekCont,_CodEmp) IF Empt( vSekContrato ) IF !lCont mSg('Código não cadastrado !','ATENÇÃO','ALERT') ENDIF RETURN(.F.) ENDIF aSayCont[nOp] := vSekContrato[1,1] IF oSay != NIL oSay:VarPut( aSayCont[nOp] ) oSay:Refresh() ENDIF ENDIF RETURN .T. Quote Link to comment Share on other sites More sharing options...
giovanyvecchi Posted March 7, 2017 Report Share Posted March 7, 2017 Temos que mudar certos conceitos sobre objeto e uso de variaveis. Tenta fazer assim Em vez de usar VALID Checa_Contratos("Produto",f_CodServ,oSayCont[1],.F.,1) .AND. !Empt(F_CodServ) Use oGetCont[1] :bValid := {|_oBjGet|Checa_Contratos("Produto",_oBjGet:VarGet(),oSayCont[1],.F.,1) .AND. !Empt(_oBjGet:VarGet())} Quote Link to comment Share on other sites More sharing options...
Marca Posted March 7, 2017 Author Report Share Posted March 7, 2017 Temos que mudar certos conceitos sobre objeto e uso de variaveis. Tenta fazer assim Em vez de usar VALID Checa_Contratos("Produto",f_CodServ,oSayCont[1],.F.,1) .AND. !Empt(F_CodServ) Use oGetCont[1] :bValid := {|_oBjGet|Checa_Contratos("Produto",_oBjGet:VarGet(),oSayCont[1],.F.,1) .AND. !Empt(_oBjGet:VarGet())} Acontece exatamente o mesmo problema. Não executa o valid Quote Link to comment Share on other sites More sharing options...
kapiaba Posted March 7, 2017 Report Share Posted March 7, 2017 LOCAL oGetCont := ARRAY( 5 ) LOCAL oSayCont := ARRAY( 5 ) // Quem e "Produto" ?? REDEFINE GET oGetCont[1] VAR f_CodServ ID 200 PICTURE "@!" OF oDlgEditContrato ; UPDATE ; BITMAP 'Get_Dados' ; ACTION (GetZoom( "Produto", oGetCont, oSayCont ), oGetCont[1]:Refresh() ) ; VALID Checa_Contratos( "Produto", f_CodServ, oSayCont ) .AND. !Empt(F_CodServ) // ERRADO!! O QUE E ESSE: 405, 150 com RECURSOS? // TRATE O oBjeto do GET na Validacao // ACTION (GetZoom( "Produto", oGetCont[1], oSayCont[1], 450,150 ),oGetCont[1]:Refresh() ) ; REDEFINE GET oGetCont[8] VAR f_DtInicio ID 201 OF oDlgEditContrato ; BITMAP 'Get_Data' ; ACTION (aRec := GetCoors(oGetCont[8]:hWnd) ,; f_DtInicio := Calendario(f_DtInicio, aRec[1], aRec[4], oDlgEditContrato), oGetCont[8]:Refresh()) ; Valid(!Empt( f_DtInicio )) FUNCTION Checa_Contratos( cProduto, f_CodServ, oSayCont ) ... Quote Link to comment Share on other sites More sharing options...
Marca Posted March 7, 2017 Author Report Share Posted March 7, 2017 João. Não tem erro nenhum na função o Aqui ->>> ERRADO!! O QUE E ESSE: 405, 150 com RECURSOS ele cria uma tela automática com o tamanho q. determino nestes valores. mais o problema esta longe de ser ai Quote Link to comment Share on other sites More sharing options...
joaosolution Posted March 7, 2017 Report Share Posted March 7, 2017 Marca Isso acontece mesmo quando a gente usa botões BUTTON pois se colocamos a opção CANCEL ele anula as validações. Sugiro você colocar o get seguinte com DISABLED e somente habilitar após passar pelo primeiro get Att João Bosco Quote Link to comment Share on other sites More sharing options...
kapiaba Posted March 7, 2017 Report Share Posted March 7, 2017 // Original TESTGET3.PRG #include "fivewin.ch" function main() local oWnd local oMenu menu oMenu MenuItem "From Code" action FromCode( oWnd ) // MenuItem "From Resource" action FromrES( oWnd ) endmenu define window oWnd title "Test Button Get Transparent" menu oMenu pixel activate window oWnd maximized return oWnd Function FromCode( oWnd ) local oDlg //local oGet1, oGet2, oGet3, oGet4 local cVar1, cVar2, cVar3, cVar4 local lActive := .f. LOCAL oGet := ARRAY( 5 ) cVar1 := SPACE(50) cVar2 := 0 cVar3 := 0 cVar4 := 0 define dialog oDlg title "From Code" pixel size 300,300 @ 10,10 get oGet[1] var cVar1 picture "@!" UPDATE ; bitmap "..\bitmaps\on.bmp" ; action GetZoom( oGet, cVar1, cVar2, cVar3, cVar4 ) ; valid Checa_Contratos( oGet, cVar1, cVar2, cVar3, cVar4 ) .AND. ; !Empty( cVar1 ) of oDlg pixel size 100,12 @ 40,10 get oGet[2] var cVar2 bitmap "..\bitmaps\on.bmp" action( msginfo( "Without Transparent" ) ) of oDlg pixel size 60,12 @ 70,10 get oGet[3] var cVar3 bitmap "..\bitmaps\chkyes.bmp" action( msginfo( "With Adjust-Transparent" ) ) of oDlg pixel size 120,12 @ 100,10 get oGet[4] var cVar4 bitmap "..\bitmaps\chkyes.bmp" ; action( if( lActive,oGet[3]:disable(),oGet[3]:enable()), ; lActive:= !lActive, oDlg:update() ) of oDlg pixel size 120,12 oGet[1]:lBtnTransparent := .t. // transparent button get oGet1 oGet[3]:disable() oGet[3]:lBtnTransparent := .t. // transparent button get oGet3 oGet[3]:lAdjustBtn := .t. // Button Get Adjust Witdh oGet3 oGet[3]:lDisColors := .f. // Deactive disable color oGet[3]:nClrTextDis := CLR_WHITE // Color text disable status oGet[3]:nClrPaneDis := CLR_BLUE // Color Pane disable status oGet[4]:lAdjustBtn := .t. activate dialog oDlg centered return nil function GetZoom( oGet, cVar1, cVar2, cVar3, cVar4 ) ? [ACAO DE GETZOOM] return nil // valid tem que entrar. function Checa_Contratos( oGet, cVar1, cVar2, cVar3, cVar4 ) LOCAL lRet := .F. IF .NOT. EMPTY( cVar1 ) cVar4 := 1000 oGet[4]:Varput( cVar4 ) oGet[4]:Refresh() lRet := .T. ELSE ? [ACAO INVALIDA, PREENCHA O CAMPO] cVar1 := "PREENCHA O CAMPO MALANDRO" oGet[1]:Varput( cVar1 ) oGet[1]:Refresh() ENDIF Return( lRet ) Quote Link to comment Share on other sites More sharing options...
Marca Posted March 7, 2017 Author Report Share Posted March 7, 2017 Marca Isso acontece mesmo quando a gente usa botões BUTTON pois se colocamos a opção CANCEL ele anula as validações. Sugiro você colocar o get seguinte com DISABLED e somente habilitar após passar pelo primeiro get Att João Bosco João. é por ai mesmo. Com a ajuda do Alessandro agente viu q. na minha classe do tGet e no método create buttom a variável ::oBtn:lCancel estava como .T. bastou trocar la por oBtn:lCancel = .F. que passou a validar e obrigatoriamente passar pelo valid do get. Quote Link to comment Share on other sites More sharing options...
aferra Posted March 7, 2017 Report Share Posted March 7, 2017 um joão sabe, agora o outro joão chutou, chutou, chutou mas quem "aferrou" foi eu, kkkkkkkk kapiaba 1 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted March 7, 2017 Report Share Posted March 7, 2017 um joão sabe, agora o outro joão chutou, chutou, chutou mas quem "aferrou" foi eu, kkkkkkkk KKKKKKKKKK, A primeira coisa que eu perguntei e ele não respondeu, porque na kbça dele o problema é sempre do Fivewin the best, foi: Nos botões tem BTNBMP? Quote Link to comment Share on other sites More sharing options...
Marca Posted March 7, 2017 Author Report Share Posted March 7, 2017 KKKKKKKKKK, A primeira coisa que eu perguntei e ele não respondeu, porque na kbça dele o problema é sempre do Fivewin the best, foi: Nos botões tem BTNBMP? Só para confirmar oq. o Ale falou q. vc chutou chutou e pra variar não leu. O problema não é no button é no get kkkkkkk kapiaba 1 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted March 7, 2017 Report Share Posted March 7, 2017 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk, quem impedia a VALIDAÇÃO, era o botão sim, pergunte ao <Aferra> Sua resposta: oBtn:lCancel = .F. Quote Link to comment Share on other sites More sharing options...
Marca Posted March 7, 2017 Author Report Share Posted March 7, 2017 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk, quem impedia a VALIDAÇÃO, era o botão sim, pergunte ao <Aferra> Sua resposta: oBtn:lCancel = .F. Sim João. Nos finalmente o problema é no buutom mesmo sendo q. o buttom criado dinamicamente dentro do get para receber a imagem da lupa por isso não havia entendido. E na classe tGet que tenho ela vinha como default .T. mais agora parece estar tudo dentro dos conformes. Obrigado a todos. 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.