Page 1 of 1
ON CHANGE's GET method update BUTTON
Posted: Thu Apr 30, 2009 3:26 pm
by fusion
Greetings,
I have this issue...
LOCA cId:= SPAC(10), cPassword:= SPAC(10)...
@ 74,180 GET cId PIXEL ON CHANGE oBtn:Refresh()
@ 85,180 GET cPassword PASSWORD PIXEL ON CHANGE oBtn:Refresh()
@ 102, 85 BUTTON oBtn PROMPT '&Start' WHEN ( !EMPTY( cId ) .AND. !EMPTY( cPassword ) ) ACTION ( ValidInfo( cId, cPassword ) )
...
happen that the button oBtn start disable because cId and cPassword are empties, but if I write in cId and start to write in cPassword, oBtn remain disable and I can't send the proper code to enable. I try with ( oBtn:Refresh(), .T. ), ( oDlg:Refresh(), .T. ), ( SysRefresh(), .T. ), etc... oBtn only updates to enable when cId or cPassword lost focus.
What code is proper in the ON CHANGE method to update state in the BUTTON..?
Thank you for your help...
Re: ON CHANGE's GET method update BUTTON
Posted: Thu Apr 30, 2009 3:37 pm
by Marcelo Via Giglio
fusion wrote:Greetings,
I have this issue...
LOCA cId:= SPAC(10), cPassword:= SPAC(10)...
@ 74,180 GET cId PIXEL ON CHANGE oDlg:aEvalWhen()
@ 85,180 GET cPassword PASSWORD PIXEL ON CHANGE oDlg:aEvalWhen()
@ 102, 85 BUTTON oBtn PROMPT '&Start' WHEN ( !EMPTY( cId ) .AND. !EMPTY( cPassword ) ) ACTION ( ValidInfo( cId, cPassword ) )
...
happen that the button oBtn start disable because cId and cPassword are empties, but if I write in cId and start to write in cPassword, oBtn remain disable and I can't send the proper code to enable. I try with ( oBtn:Refresh(), .T. ), ( oDlg:Refresh(), .T. ), ( SysRefresh(), .T. ), etc... oBtn only updates to enable when cId or cPassword lost focus.
What code is proper in the ON CHANGE method to update state in the BUTTON..?
Thank you for your help...
Re: ON CHANGE's GET method update BUTTON
Posted: Thu Apr 30, 2009 4:39 pm
by fusion
thank you Marcelo for your response, but it doesn't work...
I try with...
ON CHANGE oDlg:aEvalWhen()
ON CHANGE ( oDlg:aEvalWhen() )
ON CHANGE ( oDlg:aEvalWhen(), .T. )
ON CHANGE ( oDlg:aEvalWhen(), SysRefresh() )
ON CHANGE ( oDlg:aEvalWhen(), oDlg:Refresh() )
ON CHANGE ( oDlg:aEvalWhen(), oBtn:Refresh() )
ON CHANGE ( oDlg:aEvalWhen(), oBtn:Refresh(), oDlg:Refresh() )
ON CHANGE ( oDlg:aEvalWhen(), oDlg:Refresh(), oBtn:Refresh() )
and the button remain disable with the cId and cPassword filled...
Re: ON CHANGE's GET method update BUTTON
Posted: Thu Apr 30, 2009 5:18 pm
by Marcelo Via Giglio
Hi,
I don't sure but I can't see the container (dialog or win) of the get and button I think the ..... OF oDlg was missing in your code
regards
Marcelo
Re: ON CHANGE's GET method update BUTTON
Posted: Thu Apr 30, 2009 6:37 pm
by fusion
Thanks again Marcelo, but that's not the problem... (the container is oDlg..)
Review your comments I'm trying with...
@ 85,180 GET cPassword OF oDlg PIXEL PASSWORD ON CHANGE ( oBtn:aEvalWhen(), oDlg:aEvalWhen(), UpdateWindow(), MsgInfo( 'Testing' ) )
It works !, but if I get MsgInfo() off, doesn't work...
Another thing, it works after the second character....
Thanks again, and I will testing and hopeful for any suggestions...
Re: ON CHANGE's GET method update BUTTON
Posted: Thu Apr 30, 2009 8:29 pm
by Detlef Hoefner
Jair,
i don't think that the ON CHANGE clause is the right event to watch.
Please try somethig like:
Code: Select all
@ 85,180 GET cPassword OF oDlg PIXEL PASSWORD;
VALID ( if ( empty( cPassword ), oBtn:Disable(), oBtn:Enable() ), .t. )
Maybe that works for you.
Regards,
Detlef
Re: ON CHANGE's GET method update BUTTON
Posted: Fri May 01, 2009 2:42 pm
by Davide
Jair,
fusion wrote:It works !, but if I get MsgInfo() off, doesn't work...
please try this:
Code: Select all
@ 74,180 GET oGet1 VAR cId PIXEL
@ 85,180 GET oGet2 VAR cPassword PASSWORD PIXEL ON CHANGE (oGet1:SetFocus(),oGet2:SetFocus())
Hi,
Davide
Re: ON CHANGE's GET method update BUTTON
Posted: Fri May 01, 2009 3:01 pm
by Daniel Garcia-Gil