Page 1 of 1

Problema onlostfocus/onenter

Posted: Mon Apr 24, 2017 3:19 am
by luisvasquezcl
Hola estimados,
Tengo un combobox al cual le asigné la función validar() al evento onLostFocus.
Resulta que al presionar Enter, no ejecuta el evento onLostfocus, ese es el comportamiento correcto?.
Saludos cordiales,
Luis Vasquez
Uso : HMG.3.4.3
SisOp: Windows 10

Hello dears,
I have a combobox which I assigned the function validate () to the onLostFocus event.
It turns out that pressing Enter does not run the onLostfocus event, is that the correct behavior ?.
Best regards,
Luis Vasquez

Re: Problema onlostfocus/onenter

Posted: Mon Apr 24, 2017 6:42 am
by dragancesu
Try ON CHANGE

Re: Problema onlostfocus/onenter

Posted: Mon Apr 24, 2017 10:10 am
by mol
OnChange is called everytime when you select any option or enter character

Re: Problema onlostfocus/onenter

Posted: Mon Apr 24, 2017 10:31 am
by Pablo César
Hi Luis,

ENTER will not cause losting event in the own component but you can use ON ENTER event at ComboBox adding your own procedure to reforces Validar().

Also you can test with SET NAVIGATION EXTENDED in case user love the ENTER key... :)

Re: Problema onlostfocus/onenter

Posted: Mon Apr 24, 2017 10:43 am
by Pablo César
Sorry, my indication is not appropriated.

Please consider ON CHANGE as correct and been indicated by colleagues.

Re: Problema onlostfocus/onenter

Posted: Mon Apr 24, 2017 3:06 pm
by Rathinagiri
Can you please send a small sample?

Re: Problema onlostfocus/onenter

Posted: Tue Apr 25, 2017 5:38 pm
by EduardoLuis
Hi Luis

Try ON CLOSEUP instead ON LOSTFOCUS, this must work like you want
Cordialmente
Eduardo


Hola Luis

Prueba ON CLOSEUP en lugar de ON LOSTFOCUS, esto tendría que funcionar como deseas.
With regards
Eduardo

Re: Problema onlostfocus/onenter

Posted: Wed Apr 26, 2017 12:51 am
by luisvasquezcl
Thanks for your help, I will send a sample today or tomorrow.
best regards,
Luis Vasquez.

Re: Problema onlostfocus/onenter

Posted: Wed Apr 26, 2017 4:41 am
by Rathinagiri
For me, this sample works fine.

Code: Select all

#include <hmg.ch>

Function Main
   set navigation extended
   define window main at 0, 0 width 400 height 300 main
      define label text1label
         row 10
         col 10
         width 100
         value 'Text1'
      end label
      define textbox t1
         row 10
         col 110
         width 200
         value 'Some text'
      end textbox   
      define label combo1label
         row 40
         col 10
         width 100
         value 'Combo1'
      end label
      define combobox c1
         row 40
         col 110
         width 200
         items { 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' }         
         value 1
         onlostfocus c1focuslost()
      end combobox   
      define label text2label
         row 70
         col 10
         width 100
         value 'Text2'
      end label
      define textbox t2
         row 70
         col 110
         width 200
         value 'Some text'
      end textbox   
   end window
   main.center
   main.activate
Return

function c1focuslost
   msginfo( 'Here' )
return nil   

Re: Problema onlostfocus/onenter

Posted: Fri May 26, 2017 8:20 am
by dragancesu
Without your sample we need to guess what, maybe this

p.s. not so good example, it's slow but work