Combobox Bug Setfocus?

HMG en Español

Moderator: Rathinagiri

Post Reply
Nascimento
Posts: 13
Joined: Sun Jan 11, 2015 1:33 pm

Combobox Bug Setfocus?

Post by Nascimento »

amigos con un problema en el setfocus en el onenter del combobox
voy a mostrar un pequeño ejemplo

Code: Select all

#INCLUDE "hmg.ch"

FUNCTION Main()
 private aCard:={"Selecione a Bandeira","HIPER","MASTER","VISA","ELO","CREDCARD","CIELO"}
 private Pagou:=0
 private valor_apagar := 20  
	
	DEFINE WINDOW Form_1            ;
      AT 90,90                     ;
      WIDTH 700                    ;
      HEIGHT 350                   ;
      TITLE "erro combobox" ;
      on init (iniciar());
      MAIN
      define tab tab_Form_1 ;
	      at 34,10 ;
	         width form_1.width -40 height 250 ;
	 		    font 'ms sans serif' size 10 bold   
	      define page "Combo" 
	      @70,20 label	lb_vlrcart_1 value "Cartão 1" bold autosize transparent 
			define textbox tx_fpg_ct1
					row 70
					col 90
					width 80
					height 24
					datatype numeric
					inputmask "999,999.99"
					value 0
					tooltip "Recebimento no Primeiro Cartão"
					fontbold .t.
					tabstop .t.
					readonly .f.
					on enter (Pgt_Cartao1(this.value))
					backcolor {{255,255,255},{200,255,255},{255,255,200}}
				end textbox
				*
				define comboboxex cb_codcar_1
				  row 70
				  col  190				
				  width 150 
				  items aCard
				  value 1 
				  tooltip "Escolha a Bandeira e Tecle Enter"
				  fontname 'tahoma' 
				  fontsize 10
				  on enter (Check_Bandeira1(this.value))
				  * para ja abrir o combo quando esta em foco 
*				  on gotfocus comboshowdropdown( this.handle ) 
				end comboboxex
				*** 
			   @ 100,20 label	lb_fpg_cup value "Cupons" autosize bold  transparent
				define textbox tx_fpg_cup
					row 100
					col 90
					width 80
					height 24
					datatype numeric
					inputmask "999,999.99"
					value 0
					tooltip "Recebimento em Cupons"
					fontbold .t.
					tabstop .t.
					readonly .f.
					backcolor {{255,255,255},{200,255,255},{255,255,200}}
*					on enter (Pgt_Cupons(this.value))
				end textbox
				****
			   @ 130,20 label lb_pd_qto value "Histórico"  font 'Tahoma' size 09 bold autosize  transparent
            define textbox tx_hi_qto               
               row 150
	            col 20
	            width 260
	            height 22
	            datatype character
          *	   inputmask "!!!!!!!!!!!!!!!!!!!"
	            backcolor {{255,255,255},{200,255,255},{255,255,200}}
	            maxlength 26
	            uppercase .t.
	            value ""
	            tooltip "Historico:"
	            fontbold .t.			
	            tabstop .t.
          *	   readonly .t.
	            visible .t.
*              on lostfocus (Volta_Foco())
	            onenter (Recebe_conta())
			   end textbox	  
         end page
      end tab
      on key ESCAPE of Form_1  action Form_1.release
   END WINDOW
   Form_1.Activate
   RETURN NIL
   
*-------------------------------------------------------------------------------
   
Function Pgt_cartao1(Arg1) 
  pagou := Arg1
if (pagou) # 0
   SetProperty("form_1","cb_codcar_1","Enabled",.t.)
   DoMethod("form_1","cb_codcar_1","Setfocus")
   Return (.t.)
else
    msginfo("Valor tem que ser diferente de zero")
	 DoMethod("form_1","tx_fpg_ct1","Setfocus")
endif
Return Nil

********************************************************************************

Function Iniciar()
   SetProperty("form_1","cb_codcar_1","Enabled",.f.)
   SetProperty("form_1","tx_hi_qto","Enabled",.f.)
   SetProperty("form_1","tx_fpg_cup","Enabled",.f.)
Return Nil

********************************************************************************

Static Function Check_Bandeira1(Arg1)
  if ( Arg1 == 1)      
     msginfo("Erro Na Bandeira")
	  DoMethod("form_1","cb_codcar_1","Setfocus")   
	   Return (.f.)
  elseif( Arg1 > 1 .and. pagou < valor_apagar)  // se pagou é menor que 20 reais
     // caso o pagamento seja inferior manda o foco para o cupom 
     msginfo("manda o foco pra o cupon")
     SetProperty("form_1","tx_fpg_cup","Enabled",.t.)
     SetProperty("form_1","tx_fpg_cup","Setfocus")
  else
    // caso seja maior manda pra o historico
      msginfo("manda o foco pra o historico")
     SetProperty("form_1","tx_hi_qto","Enabled",.t.)
     SetProperty("form_1","tx_hi_qto","Setfocus")
  endif  
Return  .t.
	   

   
*-------------------------------------------------------------------------------

procedure Recebe_Conta()
  msginfo("Recebeu")
Return Nil     
   
   


si inserto el valor de 10 reales que tiene que establecer el foco en el textbox cupon, "no hace
y si inserto el valor de 20 reales o superior el foco sería para ir al historico
y no estoy consiguiendo
estoy usando minigui extended

Gracias por la ayuda de los amigos

google traductor soy brasileño :D
Post Reply