Text entry box does not lose focus

Nov 30, 2020

Hello,

I have created triggers that cause the value in text entry boxes to change when a button is clicked. Basically, I have an on screen ten key pad and triggers designed to enter the number of the button clicked into a specific text entry field if set values are true. I've attached examples of the code from three of the buttons here. 

For some reason, probably an obvious one, all the entries end up being one no matter which button I press. I know that the text entry fields are suppose to lose focus when a button is pressed, but that doesn't seem to be happening.

Can anyone assist me?

Thanks,

MeShell

 

2 Replies
Ned Whiteley

Hi MeShell,

Looking at the image you have provided, it appears that clicking on Button 1 is what is setting all your numbers to 1. The reason for this is that triggers are actioned in sequence from the top down.

When the user clicks Button 1, the value of NumberEntry1 is changed to 1 as it was previously blank. Now the second trigger changes the value of NumberEntry2 to 1 as NumberEntry1 is not blank (it was just changed by the previous trigger) and so it continues down the list of Button 2 triggers until all four variables are changed to a value of 1.

Without having a copy of your file to test, it is a bit difficult to confirm a solution, but you may find that simply reversing the order of your triggers will solve the problem. In other words, set the value of NumberEntry4 first, then NumberEntry3 and so on. That way, none of the values should change until the first blank variable is reached.

The only other thing I would point out, although it won't actually make any difference to how the triggers work, is that you don't actually need all of the conditions that you have placed in your triggers. In order for NumberEntry3, for example, to have a value in it that is not blank, NumberEntry2 and Number Entry1 must already have non-blank values. Therefore, you only need to check the previous variable to see if it is blank.

In the case of NumberEntry4, your trigger would now look like this:

 

In case you can't get it to work, I have also attached an example I made a while ago to help someone who was working on a combination lock. I have used four Number variables and, for testing purposes, the correct code to open the lock is accessible by clicking the Correct Code button.

If you have any further queries, just get back to me here.

This discussion is closed. You can start a new discussion or contact Articulate Support.