What does 'control loses focus' mean?


I have a question about variable.

I see it when I use a trigger related to Adjust variable.

I bought a book about Story line and it says "that is, when the learner clicks away from the Data Entry box".

I think the reason why I can't understand is my English problem, but I still want to know it.

Please let me know.

Thank you.

22 Replies
Dennis Hall

Hi Dongyup:

The book is correct.

Think of user control as your hand. When you have your computer mouse in your hand, you are using your hand to control the mouse. When you enter information using your computer keyboard, the mouse is not in control, but now the keyboard is.

So the mouse has lost control (or control lost focus from the mouse) and the keyboard has taken control (or control has taken focus to the keyboard).

Best Regards,

Dennis Hall

Jazzmine O

Not gonna lie, I had/have the same question. Partially because I didn't understand it when I first saw it, and partially because now I'm trying to figure out why something seems to be wrong with my triggers. I have a "pick one" freeform question set up that's linked to multiple text entries. The triggers work perfectly on the first attempt, but on the second attempt, even if the learner corrects his/her answers, the triggers seem to think that the answers are still wrong. So I'm wondering if "control loses focus" means that the value would reset as soon as the learner types in the box (even if the first entry has already been "submitted"). I made additional triggers to set the value to "blank" after the learner clicks "try again" from the free form automatic response, but something still isn't right. Was hoping more information about the phrase in question would help! :p


Wendy Farmer

Control loses focus means an action occurring outside of the text entry box

e.g the user clicking next or submit or tabbing from one field to another. Once they do that whatever they have typed into the text field becomes 'set'.

eg if they type 'animal' into the text entry and don't click outside of the text entry box nothing happens. Once they click outside 'animal' becomes the entered value...hope that makes sense

Jazzmine O

Hmm... perhaps, Wendy... but my bigger question is whether that focus is restored at any point after the variable is "set". It seems like once it's set, it's set. I have no way of really knowing since I can't see current variable states, but that's what I am becoming more convinced is happening. Is there any way to restore "control focus" to a text entry box? What I think is happening is that my learner will be able to enter text once, but then once the "control loses focus", then it never truly regains focus (even if I force it to be blank) and therefore, whatever else a learner would put in the entry would still not register as the new value. Am I wrong?

Wendy Farmer

Hi Jazzmine

you can add a textbox on your slide and go to Insert > Reference and choose the variable you have assigned to the text entry field. When you type something in and click outside what you typed into the text entry field should be visible in the added textbox - this will help you check what is being set.

Depending on how you want to reset the variable, say the user clicks a reset button or they return to that slide,  you can add a trigger: 

adjust variable 'text entry' to value blank when timeline starts or when user clicks reset or which action you choose - that should clear whatever was previously entered. Make sure your slide properties are set to 'reset to initial state'.

if you have a story file started - you can upload here and it will be easier for someone to help if they can see your setup.

just a note : if you are publishing to html5 output the text entry will dynamically update as you type into the text entry field.

Jazzmine O

Thanks for being so helpful, Wendy! I tried what you're talking about-- creating a trigger to set the value to blank, but I don't know if I explained what I think happens when I do that. I think it just keeps it blank. The only thing that seems to work is if I change the slide's properties to "reset to initial state" (we were thinking along the same lines!! :) ). However, this means that the freeform question can't keep track of how many times a learner has attempted the question, so it just puts the learner in this endless loop unless I keep the "next" button on the player that can jump them to the next slide.

I've attached an example of what I'm working with. For this example, I kept the slide properties at "automatically decide" because that's what I'd like to keep it as if we can get this figured out since that will allow me to determine how many times a learner can attempt to "try again."

To see what I'm talking about in action, try typing in incorrect letters the first time, then type the correct letters the second time. Even though the letters are correct the second time, it still tells you you're wrong. If you type in the correct letters the first time, all is well.

In summary: we know that changing the slide properties to "reset" is a functional workaround, but not preferred. And creating triggers to change the variables to blank does not work. What is happening to make the text fields yield a negative selection? How can we reset them for the learner without sacrificing how many times the learners can attempt the same question?

Jazzmine O

But by-the-by, Wendy, with your example, the reset thing DOES seem to work. I just noticed that your slide properties on that second slide are still set to "automatically decide." Even though yours is different... It's the same principle, so if it can work with a single text entry, I don't see why or how it couldn't with multiple like in my project. I wonder what the hitch is with my slide then. Are my triggers off?

Jazzmine O

Here's the same example project I submitted earlier but updated with "reset" triggers added to set text entry variables to blank when learners click "try again". I tested with my prescribed route-- wrong answers first time, correct the second time--and am still getting the same problem: "you're wrong" feedback when the learner would be correct.

Since yours works, I'm very confused now.

Louisa Antoine

Hi all, 

I have a question about text entry fields. To trigger the 'Control loses focus' action, sometimes pressing the 'Enter' key works and sometimes pressing the 'Tab' key works.

For consistency, I would prefer if this was always triggered by the user pressing the Enter key. Is there any way I can do this?

Wendy Farmer

Hi Louise

in order for SL to validate the entry in the text field the user must click somewhere on the slide  outside of the TE box - so it can be another object or a key or a button. I don’t think you can restrict it to just the enter key. 

You may want to have a popup that displays if they hit the tab key that says hit Enter but by that time the field is already validated - not sure there would be any benefit.