Problem with Numeric Masked Textbox and 'On Change' event

Moderator: Rathinagiri

Post Reply
User avatar
gfilatov
Posts: 1057
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Problem with Numeric Masked Textbox and 'On Change' event

Post 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
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

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

Post 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.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

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

Post 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.
Attachments
chgtest.zip
(648 Bytes) Downloaded 430 times
Luigi from Italy
www.L3W.it
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

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

Post 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.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply