exitField firing multiple times
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
exitField firing multiple times
I create a new stack containing one field "AAA"
- LockText is false
- FocusWithKeyboard is true
- Script is shown below:
on closeField
Answer "CloseField" & the name of me
end closeField
on exitField
Answer "ExitField" & the name of me
end exitField
1) If I click on field AAA, change its contents, and then click outside it I trigger the answer CloseField dialogue
2) If I click on field AAA, don't change its contents, and then click outside it I trigger the answer ExitField dialogue
All good so far.
3) If I then click again on the card outside of field AAA, the answer ExitField dialogue appears again. ExitField keeps firing everytime that I click outside of field AAA
4) If I click on field AAA, don't change its contents, and then click on another field with LockText = True and FocusWithKeyboard = true; I trigger TWO answer ExitField dialogues from field "AAA"
5) If I click on field AAA, change its contents, and then click on another field with LockText = True and FocusWithKeyboard = true; I trigger BOTH a CloseField and an ExitField from field "AAA"
Is there an easy way to damped the enthusiasm of exitField and get it (or CloseField) to fire only once for each openField? I've tried "Focus on nothing", but that didn't do it. Even after "Focus on nothing", exitFields keep firing for field AAA (without AAA being re-opened). I realise that I could have openField set the LetExitFieldFire of this card to true, then have closeField and exitField set the LetExitFieldFire of this card to false, and add an "if LetExitFieldFire" statement within each exitField handler; but I just wondering if there is a simple button that I can tick to solve this.
Thanks in advance
Kim
- LockText is false
- FocusWithKeyboard is true
- Script is shown below:
on closeField
Answer "CloseField" & the name of me
end closeField
on exitField
Answer "ExitField" & the name of me
end exitField
1) If I click on field AAA, change its contents, and then click outside it I trigger the answer CloseField dialogue
2) If I click on field AAA, don't change its contents, and then click outside it I trigger the answer ExitField dialogue
All good so far.
3) If I then click again on the card outside of field AAA, the answer ExitField dialogue appears again. ExitField keeps firing everytime that I click outside of field AAA
4) If I click on field AAA, don't change its contents, and then click on another field with LockText = True and FocusWithKeyboard = true; I trigger TWO answer ExitField dialogues from field "AAA"
5) If I click on field AAA, change its contents, and then click on another field with LockText = True and FocusWithKeyboard = true; I trigger BOTH a CloseField and an ExitField from field "AAA"
Is there an easy way to damped the enthusiasm of exitField and get it (or CloseField) to fire only once for each openField? I've tried "Focus on nothing", but that didn't do it. Even after "Focus on nothing", exitFields keep firing for field AAA (without AAA being re-opened). I realise that I could have openField set the LetExitFieldFire of this card to true, then have closeField and exitField set the LetExitFieldFire of this card to false, and add an "if LetExitFieldFire" statement within each exitField handler; but I just wondering if there is a simple button that I can tick to solve this.
Thanks in advance
Kim
Re: exitField firing multiple times
Sample stack attached
- Attachments
-
- CloseField.7z
- (664 Bytes) Downloaded 177 times
-
- VIP Livecode Opensource Backer
- Posts: 9648
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: exitField firing multiple times
Hi.
I haven't tried your experiment, and want to ask one question first.
Is the handler in the card script?
Craig Newman
I haven't tried your experiment, and want to ask one question first.
Is the handler in the card script?
Craig Newman
Re: exitField firing multiple times
Hi Craig
Card and stack script are empty
I am now wondering if its something to do with how exitField interacts with the Answer command.
Regards
Kim
Card and stack script are empty
I am now wondering if its something to do with how exitField interacts with the Answer command.
Regards
Kim
Re: exitField firing multiple times
In the development menu, you can find the message watcher, which gives you a list of all the messages as they fire. In real time, so it's not easy to read, but with some judicious stopping and starting and filtering, you could track down the sequence of events and what happens immediately before the exitField.
-
- VIP Livecode Opensource Backer
- Posts: 7228
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: exitField firing multiple times
What SparkOut said. Or instead of an answer dialog, just use "put" which will put the response into the message box. Either way you can rule out the dialog.
Code: Select all
put "ExitField" & the name of me
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: 9823
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: exitField firing multiple times
That may be. Have you tried outputting to a log field instead?
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
Re: exitField firing multiple times
Thanks Craig, Sparkout, Jacque & Richard
It does appear to be something to do with an interaction between the Answer dialogue and exitField/CloseField.
When I removed "Answer" and replaced this with writing to a logfile, the results for exitField and closeField where as-documented in the LC dictionary.
Regards
Kim
It does appear to be something to do with an interaction between the Answer dialogue and exitField/CloseField.
When I removed "Answer" and replaced this with writing to a logfile, the results for exitField and closeField where as-documented in the LC dictionary.
Regards
Kim
-
- VIP Livecode Opensource Backer
- Posts: 7228
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: exitField firing multiple times
LC automatically selects the first editable field when a card opens and that triggers all the standard field messages. I'm guessing the answer dialog has one of those somewhere which would cause what you see. I have mixed feelings about this behavior because it often gets in the way.
Typically when a handler is placed in a script where it will be triggered by controls you don't want to deal with, a check for the target fixes the problem. If the target doesn't meet your criteria, exit or pass the message.
Typically when a handler is placed in a script where it will be triggered by controls you don't want to deal with, a check for the target fixes the problem. If the target doesn't meet your criteria, exit or pass the message.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com