Page 1 of 1

Problem with Numeric Masked Textbox and 'On Change' event

Posted: Tue Nov 03, 2009 4:29 pm
by gfilatov
Hello Roberto,

I have a bugreport about the following problem. :(
The Masked Textbox control execute 'On Change' procedure at the GotFocus and LostFocus events.
Reported by Marcelo Torres at the English minigui forum.

I guess that this problem is connected with management of the public switch variable _HMG_SYSDATA [ 253 ].

The demo sample is below: :arrow:

Code: Select all

#include 'minigui.ch'

Function Main()
*--------------------
Local cUser
Local cPassword

DEFINE WINDOW Login ;
AT 0,0 ;
WIDTH 400 HEIGHT 200 ;
TITLE 'Login ' ;
MAIN ;
BACKCOLOR {192,192,192}


@045,070 LABEL Label_User ;
VALUE "Usuario " ;
WIDTH 120 ;
HEIGHT 35 ;
FONT "Arial" SIZE 09;
BACKCOLOR {192,192,192} ;
FONTCOLOR BLACK BOLD

@045,300 LABEL Label_chk_User ;
VALUE "" ;
WIDTH 120 ;
HEIGHT 35 ;
FONT "Arial" SIZE 09;
BACKCOLOR {192,192,192} ;
FONTCOLOR RED BOLD

@090,070 LABEL Label_Password ;
VALUE "Password " ;
WIDTH 120 ;
HEIGHT 35 ;
FONT "Arial" SIZE 09;
BACKCOLOR {192,192,192} ;
FONTCOLOR BLACK BOLD

@090,300 LABEL Label_chk_pass ;
VALUE "" ;
WIDTH 120 ;
HEIGHT 35 ;
FONT "Arial" SIZE 09;
BACKCOLOR {192,192,192} ;
FONTCOLOR RED BOLD

@045,170 TEXTBOX p_User ;
HEIGHT 25 ;
VALUE cUser ;
WIDTH 120 ;
FONT "Courier" SIZE 09 ;
NUMERIC ;
INPUTMASK '99999' ;
ON ENTER IIf( !Empty( login.p_User.Value ) , Login.p_Password.SetFocus , Login.p_user.SetFocus ) ;
ON CHANGE fCambiaUser()


@090,170 TEXTBOX p_password ;
VALUE cPassWord ;
PASSWORD ;
FONT "Courier" SIZE 09 ;
TOOLTIP "Clave de Acceso" ;
ON ENTER Iif( !Empty( login.p_password.Value ) , Set_Logueo() , login.p_password.SetFocus )

@ 130,070 BUTTON Bt_Login ;
CAPTION '&Login' ;
ACTION Set_Logueo() ;
FONT "MS Sans Serif" SIZE 09 FLAT


@ 130,190 BUTTON Bt_Logoff ;
CAPTION '&Cancela' ;
ACTION Cancela_Logueo() ;
FONT "MS Sans Serif" SIZE 09 FLAT

END WINDOW

login.p_user.setfocus

CENTER WINDOW login
ACTIVATE WINDOW login


Return


Function Set_Logueo()
*-----------------------

MsgBox("funcion Set_Logueo")

Return


Function Cancela_Logueo()
*-----------------------

MsgBox("Cancela logueo")

Return


Function fCambiaUser()
*-----------------------
static n:=1
Login.title:="fCambiaUser"+str(n++)

Return

Re: Problem with Numeric Masked Textbox and 'On Change' event

Posted: Tue Nov 03, 2009 6:37 pm
by Roberto Lopez
gfilatov wrote:Hello Roberto,

I have a bugreport about the following problem. :(
The Masked Textbox control execute 'On Change' procedure at the GotFocus and LostFocus events.
Reported by Marcelo Torres at the English minigui forum.
<...>
Thanks for the report Grigory.

I'll review it ASAP.

Re: Problem with Numeric Masked Textbox and 'On Change' event

Posted: Tue Nov 03, 2009 11:46 pm
by l3whmg
Hello,
I notice the same problem; attached you can find a simple program as an example.
While with the text field the clause "on change" works fine, with numeric field don’t work.
1) at the program start up “on change” begins operation (only for numeric field)
2) changing the value seems to enter an infinite loop

Thanks for your help.

Re: Problem with Numeric Masked Textbox and 'On Change' event

Posted: Wed Nov 04, 2009 12:42 am
by Roberto Lopez
l3whmg wrote:Hello,
I notice the same problem; attached you can find a simple program as an example.
While with the text field the clause "on change" works fine, with numeric field don’t work.
1) at the program start up “on change” begins operation (only for numeric field)
2) changing the value seems to enter an infinite loop

Thanks for your help.
Thanks for the report.