I am trying t let the user input special characters ( those with shift, alt, ctrl ) into the experiment.
In order to get “@” I get the key response ‘lshift’ ‘2’ which I could handle, but the software will run in 4 different countries with different keyboard layout. There the symbol is at ‘alt’,‘ctrl’,‘2’ or ‘alt’,‘ctrl’,‘q’.
This makes it very inconvenient to create the language (keyboard setting) code to combining the multi-key entries.
Any suggestion ( I am a rather Newbee, however, my current experiment is already heavily Python modified )
But the texbox gives you the correct input, right? (i.e. the actual characters you want rather than the set of keypresses required to type them.) So once the routine ends, you should just be able to get the content of the textbox into a variable and do what you want with it.
e.g. in the “end routine” tab of a code component, put something like this:
I think Wakefield is on the money here, if you are setting text then it will set it from the Code component each frame, overriding whatever has been inputted to the Textbox! If you try making a new experiment with just a textbox in, does it still have this problem?
no, I do not get the textbox to show me anything. If I can get the box to have my typed data, I would be fine.
To Wake &TP:
I tried empty text boxes, etc. As soon as the textbox appears, the mouse becomes active, but no input is shown. I tried “constant” and “set every frame”.
Again, I am not trying to “output” text, I am trying to read special characters like § $ @ which are on different keyboard locations as a function of the country you are in. I can not simply use the language of the experiment as an indicator ( I am changing the displayed text as a function of the desired language ) because the keyboard and the language are different. I have 3 keyboards attached to my US-language computer ( 2 real, 1 virtual )
Shortened Problem Statement
the immediate problem is:
during the test I need to read the e-mail address of the person taking the test.
This has to be done from within the program, since it runs in a loop in a public hallway.
Then this is the only issue that needs to be solved. The TextBox component should work as-is, with no custom code needed at all.
I think the issue is that in your component, you have selected to update on every frame. That means the content will just keep getting reset to “Type here”, regardless of what the subject types. Change that to “Constant” instead. That means it will be initialised to “Type here”, but can subsequently be edited. I know you said above that you had tried changing these settings, but I wonder if there was still some conflict with your custom code there. If you create a fresh Builder experiment containing nothing other than an editable textbox, you should see how the update settings work.
I think the terminology in the update settings for this component don’t carry over very well from the way they work in other components - it is a new feature, and this misunderstanding shows that it might need to be tweaked.
@jon: perhaps we need to rethink the labels here for this specific component, as they seem contradictory when the “editable” setting is applied. i.e. “constant” actually means “editable”, while “every frame” means “constant” (unless the content of the text field is a code expression I guess). This is tricky, as the meanings shift depending on whether the mode is set to editable or not, and whether the content in the text field is static or a code expression.
thanks a lot and @jon is also on the mark:
Of all the items I tried, I never thought about an active input as “constant”. Now I have to figure out how the string is named ( I assume the standard textbox.keys ), so still work ahead, but you help was valuable ( never understood why it would be good to be non valuable, as in invaluable . . . . , but english is my 2nd language, so what do I now)
No it is like the standard text component, as suggested above:
That is, the TextBox component doesn’t collect raw keypresses: it stores the resulting characters (e.g. it doesn’t record whether someone pushed the shift key, it just gives the resulting capital letter or symbol).
One more question to textbox:
is there a fast way to terminate ?
I see “condition” but so far have only been able to terminate using escape.
Or do I have to write the code to check the string for specific characters inside the routine ?