When to use it

When you want people to enter a word or a list of words.

You can also do this with readkeys (see below), but textbox has some advantages over readkeys.

What it does

When you use textbox, a rectangle is drawn on the experiment screen in which participants can enter words. You can set:

  • the size of the rectangle in which people can enter text

  • the color of the text and the color of the rectangle

  • the size of the text and the font of the text (arial, times, or courier)

How is it different from readkeys

  • readkeys was developed for PsyToolkit in the past and is older.

  • readkeys ends on pressing the Enter (also known as Return) key

  • readkeys cannot handle special characters, such as non-Latin characters

  • only textbox creates an HTML textarea overlay on top of the experiment, this allows for entry of any special character

  • unlike readkeys, textbox does not wait, you need to let it follow by a readmouse command to let the participant complete the text entry (see example below)

Tip

When people get a textbox on the screen, they will probably use the mouse to enter text in it. If you have a readmouse command to complete the text entry, this might end the textentry before you want to. Make sure that the readmouse command following the textbox uses a range option. This ensures that people need to use the mouse after textentry on a very specific range of rectangles or other stimuli to complete.

If you do not understand it, just try it out and see what happens with or without range.

Example

task test
  show text "Enter words and click green rectangle when done" 0 -280
  show rectangle 300 250 100 100 green
  textbox new 0 0 790 590 white blue 24 arial
  readmouse l 2 99999 range 2 2
  save %%mylist textbox
  textbox 1 clear

block x
  tasklist
    test 1
  end