kapiaba Posted July 3, 2013 Report Share Posted July 3, 2013 Buenas galera, não custa perguntar: Tem algum comando no fivewin ou xharbour equivalente ao CLEAR GETS? Para deixar todos os GETS com WHEN( .F. ) ? Obg, abs. Quote Link to comment Share on other sites More sharing options...
emotta Posted July 3, 2013 Report Share Posted July 3, 2013 Pega essa ai, rascunhei agora, então se der algum erro avisa.... Function FwClearGets(oDlg) Local nI Local nJ For nI := 1 to Len(oDlg:aControls) If oDlg:aControls[nI]:ClassName()=="TGET" oDlg:aControls[nI]:Disable() ElseIf oDlg:aControls[nI]:ClassName()=="TFOLDER" For nJ := 1 to Len(oDlg:aControls[nI]:aDialogs) FwClearGets(oDlg:aControls[nI]:aDialogs[nJ]) Next EndIf Next Return Quote Link to comment Share on other sites More sharing options...
kapiaba Posted July 3, 2013 Author Report Share Posted July 3, 2013 INFELIZMENTE não funcionou Eduardo, mas mesmo assim, valew() Quote Link to comment Share on other sites More sharing options...
emotta Posted July 3, 2013 Report Share Posted July 3, 2013 veja se pelo menos entrou no FOR... mudei para considerar maiuscula e miniscula no nome da classe Function FwClearGets(oDlg) Local nI Local nJ For nI := 1 to Len(oDlg:aControls) If AllTrim(Upper(oDlg:aControls[nI]:ClassName()))=="TGET" oDlg:aControls[nI]:Disable() ElseIf AllTrim(Upper(oDlg:aControls[nI]:ClassName()))=="TFOLDER" For nJ := 1 to Len(oDlg:aControls[nI]:aDialogs) FwClearGets(oDlg:aControls[nI]:aDialogs[nJ]) Next EndIf Next Return Quote Link to comment Share on other sites More sharing options...
kapiaba Posted July 3, 2013 Author Report Share Posted July 3, 2013 Não entra no FOR nI. Além da não entrar, ainda DETONA o comando RIGHT do Get. Quote Link to comment Share on other sites More sharing options...
emotta Posted July 3, 2013 Report Share Posted July 3, 2013 mas se não entra no FOR é pq a dialog (oDlg) que está passando não tem nenhum GET no aControls... rs... tb se nao entra no FOR a funcao simplesmente nada faz, o problema do right deve ser outro... tente fazer o exemplo em uma dialog simples e com apenas 3 gets normais... Quote Link to comment Share on other sites More sharing options...
kapiaba Posted July 3, 2013 Author Report Share Posted July 3, 2013 Não dá, pois tenho que IMITAR programa identico ao FOR DOS, para não modificar a lógica original, senão, eu me phrodo... kkk o WHEN( .F.) Resolve, mas é WHEN( .F.) pra kray.... kkkkkkkkkkkkkkkkk obg, abs Quote Link to comment Share on other sites More sharing options...
Yury Posted July 3, 2013 Report Share Posted July 3, 2013 //------------------------------------------------------------------- METHOD AEvalWhen(lDisableAll) CLASS TWindow local n local aControls := ::aControls default lDisableAll:=.F. if aControls != nil .and. ! Empty( aControls ) for n = 1 to Len( aControls ) if aControls[ n ] != nil .and. aControls[ n ]:bWhen != nil if lDisableAll ::aControls[ n ]:Disable() else if Eval( aControls[ n ]:bWhen ) ::aControls[ n ]:Enable() // keep this as :: else ::aControls[ n ]:Disable() // keep this as :: endif endif endif next endif return nil //------------------------------------------------------------------- Olá, vc pode modificar a sua classe TWindow, método AevalWhen para fazer isso basta chamar oDlg:AevalWhen(.T.) para desabilitar tudo Abraço Quote Link to comment Share on other sites More sharing options...
Luiz Fernando Posted July 3, 2013 Report Share Posted July 3, 2013 Ola Kapiaba, não sei como é seus objeto dos gets, mais é bem pratico trabalhar com array, pois dai fica fácil fazer isto e outros procedimentos que envolva todos gets da dialog... local oGet[10] redefine get oGet[1] ... redefine get oGet[2] ... usando assim basta dar um for next Abraços Luiz Fernando Quote Link to comment Share on other sites More sharing options...
emotta Posted July 3, 2013 Report Share Posted July 3, 2013 show de bola essa solução e nem precisa reinventar a roda... kkk muito boa Yury //------------------------------------------------------------------- METHOD AEvalWhen(lDisableAll) CLASS TWindow local n local aControls := ::aControls default lDisableAll:=.F. if aControls != nil .and. ! Empty( aControls ) for n = 1 to Len( aControls ) if aControls[ n ] != nil .and. aControls[ n ]:bWhen != nil if lDisableAll ::aControls[ n ]:Disable() else if Eval( aControls[ n ]:bWhen ) ::aControls[ n ]:Enable() // keep this as :: else ::aControls[ n ]:Disable() // keep this as :: endif endif endif next endif return nil //------------------------------------------------------------------- Olá, vc pode modificar a sua classe TWindow, método AevalWhen para fazer isso basta chamar oDlg:AevalWhen(.T.) para desabilitar tudo Abraço Quote Link to comment Share on other sites More sharing options...
kapiaba Posted July 3, 2013 Author Report Share Posted July 3, 2013 //------------------------------------------------------------------- METHOD AEvalWhen(lDisableAll) CLASS TWindow local n local aControls := ::aControls default lDisableAll:=.F. if aControls != nil .and. ! Empty( aControls ) for n = 1 to Len( aControls ) if aControls[ n ] != nil .and. aControls[ n ]:bWhen != nil if lDisableAll ::aControls[ n ]:Disable() else if Eval( aControls[ n ]:bWhen ) ::aControls[ n ]:Enable() // keep this as :: else ::aControls[ n ]:Disable() // keep this as :: endif endif endif next endif return nil //------------------------------------------------------------------- Olá, vc pode modificar a sua classe TWindow, método AevalWhen para fazer isso basta chamar oDlg:AevalWhen(.T.) para desabilitar tudo Abraço Fala Yuri, tava sumido meu rei?? Eu não quero desabilitar tudo, supunhetemos que eu TENHA 50 GETS, quero que 30 fiquem com WHEN( .F. ) e 20 fiquem com WHEN( .T. ) KAPISKA? Abs, Quote Link to comment Share on other sites More sharing options...
emotta Posted July 3, 2013 Report Share Posted July 3, 2013 Kapiada, nesse caso monte um array com os objetos GET que deseja desabilitar e use o método DISABLE neles Fala Yuri, tava sumido meu rei?? Eu não quero desabilitar tudo, supunhetemos que eu TENHA 50 GETS, quero que 30 fiquem com WHEN( .F. ) e 20 fiquem com WHEN( .F. ) KAPISKA? Abs, kapiaba 1 Quote Link to comment Share on other sites More sharing options...
aferra Posted July 4, 2013 Report Share Posted July 4, 2013 tem folder nessa dialog? vai ter folder em alguma dialog? o que vc está querendo é algo genérico ou somente para esse evento? Quote Link to comment Share on other sites More sharing options...
Erciley Junior Posted July 4, 2013 Report Share Posted July 4, 2013 Não adianta fazer DISABLE nos objetos se o bloco de código bWhen dos objetos estiver definido além do disable, tem que "desativar" o bWhen emotta e yury já responderam corretamente, é só ajustar ao que precisa agora, colocar um IF aqui, um parâmetro ali......... Quote Link to comment Share on other sites More sharing options...
MatheusFarias Posted July 4, 2013 Report Share Posted July 4, 2013 Bem aqui no programa eu faço parecido com a primeira resposta , tambem me baseio na id do Get ou da classe tanto para usar o Hide como o Disabled ai vai as funçoes Function Desabilita_Controles(oDlg) // Passar Dialog no Parametro , caso for um Folder passar o oDlg:aDialogs[1] local y,x:= len (oDlg:aControls) For y:=1 to x oDlg:aControls[y]:Disable() next Function Desabilita_Controles2(oDlg) //Essa voce so precisa mudar a classe local y,x:= len (oDlg:aControls) For y:=1 to x if oDlg:aControls[y]:classname<>"TBUTTONBMP" oDlg:aControls[y]:Disable() endif next Function Desabilita_Controles3(oDlg,IdInicial) // Essa Funciona pelo Numero da Id local y,x:= len (oDlg:aControls) For y:=1 to x if oDlg:aControls[y]:nId>=IdInicial oDlg:aControls[y]:Disable() endif next Quaisquer duvidas ta ai os contatos : Matheus@inteligence.com.br / Matheushchaves@gmail.com / d.matheusfarias@hotmail.com / matheushchaves@hotmail.com / (83) 9854-0294 Quote Link to comment Share on other sites More sharing options...
aferra Posted July 4, 2013 Report Share Posted July 4, 2013 o que eu utilizo e funciona com when determinado no get. DEFINE DIALOG oDlg FROM 0,0 TO 460,900 PIXEL .... .... Instruções de SAY e GET @ 087,005 FOLDER oFld OF oDlg PROMPT "&Forma de Pagamento", "&Centro Administrativo", "&Observação" ; PIXEL SIZE 442,123 .... .... IF <parametro> TravaGet( oDlg, oFld ) ENDIF ACTIVATE DIALOG oDlg CENTERED FUNCTION TravaGet( oDlgAdj, oFldAdj ) LOCAL nCtrDlg, nCtrFld1, nCtrFld2 IF oDlgAdj # NIL FOR nCtrDlg:=1 TO LEN(oDlgAdj:aControls) cNomeClase:=oDlgAdj:aControls[nCtrDlg]:ClassName() IF cNomeClase=="TSAY" ELSEIF cNomeClase=="TRADIO" IF !oDlgAdj:aControls[nCtrDlg]:lChecked oDlgAdj:aControls[nCtrDlg]:DISABLE() ENDIF ELSEIF cNomeClase=="TCHECKBOX" oDlgAdj:aControls[nCtrDlg]:DISABLE() ELSEIF cNomeClase=="TFOLDER" ELSEIF cNomeClase == "TBTNBMP" ELSEIF cNomeClase=="TXBROWSE" ELSEIF cNomeClase=="TMULTIGET" oDlgAdj:aControls[nCtrDlg]:lReadOnly:=.T. ELSE oDlgAdj:aControls[nCtrDlg]:DISABLE() ENDIF NEXT ENDIF IF oFldAdj # NIL FOR nCtrFld1:=1 TO LEN(oFldAdj:aDialogs) FOR nCtrFld2:=1 TO LEN(oFldAdj:aDialogs[nCtrFld1]:aControls) cNomeClase:=oFldAdj:aDialogs[nCtrFld1]:aControls[nCtrFld2]:ClassName() IF cNomeClase == "TSAY" ELSEIF cNomeClase == "TRADIO" IF !oFldAdj:aDialogs[nCtrFld1]:aControls[nCtrFld2]:lChecked oFldAdj:aDialogs[nCtrFld1]:aControls[nCtrFld2]:DISABLE() ENDIF ELSEIF cNomeClase == "TCHECKBOX" oFldAdj:aDialogs[nCtrFld1]:aControls[nCtrFld2]:DISABLE() ELSEIF cNomeClase == "TFOLDER" ELSEIF cNomeClase == "TBTNBMP" ELSEIF cNomeClase == "TXBROWSE" ELSEIF cNomeClase == "TMULTIGET" oFldAdj:aDialogs[nCtrFld1]:aControls[nCtrFld2]:lReadOnly:=.T. ELSE oFldAdj:aDialogs[nCtrFld1]:aControls[nCtrFld2]:DISABLE() ENDIF NEXT NEXT ENDIF RETURN NIL 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.