tabKey o exitField
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 90
- Joined: Sun Feb 15, 2015 2:51 pm
tabKey o exitField
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
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
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: tabKey o exitField
Hi Alessio,
It seems possible.
Here is a way to do it:
I guess a more clever solution will come.
Edit: All handlers are on cd script
Best regards
Jean-Marc
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
Edit: All handlers are on cd script
Best regards
Jean-Marc
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 7245
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: tabKey o exitField
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?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: tabKey o exitField
@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
Just after i've written my post I wondered why you need it.
As I have guessed, Jacque posted a smartest answer
Jean-Marc
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 9846
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: tabKey o exitField
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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 90
- Joined: Sun Feb 15, 2015 2:51 pm
Re: tabKey o exitField
You're right, I will do so.FourthWorld wrote: ↑Sun Apr 14, 2019 7:59 pmYou 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.
Thanks