Page 1 of 1
tabKey o exitField
Posted: Sun Apr 14, 2019 10:21 am
by AlessioForconi
Hi everyone,
I have a text validation function in a field that I call when I go to the next field.
Since I wish I could use both the tab key and the mouse to move, I call it both on tabKey and on exitField (if I use the mouse).
The fact is that after tabKey is still called exitField (which is right).
It's possible to make sure not to invoke exitField if it has been called tabKey?
Thank you
Re: tabKey o exitField
Posted: Sun Apr 14, 2019 11:52 am
by jmburnod
Hi Alessio,
It seems possible.
Here is a way to do it:
Code: Select all
on exitfield
if the uMyUseExitFld of this cd then -- message comes from mouse
beep
else -- message comes from tabkey
end if
end exitfield
on tabkey
setMyUseExitFld false
send "setMyUseExitFld true" to me in 10 milliseconds
pass tabkey
end tabkey
on setMyUseExitFld pBool
set the uMyUseExitFld of this cd to pBool
end setMyUseExitFld
I guess a more clever solution will come.
Edit: All handlers are on cd script
Best regards
Jean-Marc
Re: tabKey o exitField
Posted: Sun Apr 14, 2019 4:26 pm
by jacque
Since exitfield is always sent when leaving the field by either mouse or tab, I'd just validate on exitfield only. Is there some reason it needs to be done in tab also?
Re: tabKey o exitField
Posted: Sun Apr 14, 2019 4:48 pm
by jmburnod
@Alessio
Just after i've written my post I wondered why you need it.
As I have guessed, Jacque posted a smartest answer
Jean-Marc
Re: tabKey o exitField
Posted: Sun Apr 14, 2019 7:59 pm
by FourthWorld
You might consider closeField rather than exitField. closeField is sent when leaving a field after the contents have changed, while exitField is sent when the field has not changed. Probably not much validation needed when the field doesn't change.

Re: tabKey o exitField
Posted: Mon Apr 15, 2019 3:33 pm
by AlessioForconi
FourthWorld wrote: ↑Sun Apr 14, 2019 7:59 pm
You might consider closeField rather than exitField. closeField is sent when leaving a field after the contents have changed, while exitField is sent when the field has not changed. Probably not much validation needed when the field doesn't change.
You're right, I will do so.
Thanks