textInput

 element objects

A response handler element that records subject response by typing text in a text box, and optionally saves to a text file. At default the subject can type text of any length and press Enter to record it as a response and end the element. Alternatively you can let the user press Enter for line breaks and any mouse button to record response.

See also keyPress elements.

Psychtoolbox text renderer

By default Psychtoolbox uses its own text renderer plugin. If this fails, it falls back to a more basic text renderer in your operating system and reports so in its messages at experiment startup. In this case you may see problems with text quality, alignment, or boundaries. See Psychtoolbox Screen('DrawText') for general information on text renderers, and DrawTextPlugin help for troubleshooting.

▸ Object ends on its own?

By default yes, when it records one response. You can change number of responses to wait for in property maxNumResponses.

"Ends on its own" means ends automatically at that point. If an element can end on its own, you don't need to set end conditions for it in property end (unless you want it to maybe end earlier).

No—runs until any condition you set in property end.

Input properties
Record properties
textInput
elements (see below)

fontName
fontSize
color
lineSpacing
boxSize
margin
boxColor
enterResponds
recordNumeric
fileName
numberFile
minNumDigitsInFileName
n_device

All visual elements
position
depth

nn_eyes
rotation
flipHorz
flipVert

colorMask
alpha
intensity
contrastMult
convolution
shader
filterOrder
filterGrayscale
filterResolutionMult
filterGamma

channelResolution
backColor
addDisplay

All visual elements
position

All adjuster elements have
adjust

All response handler elements
translateResponse
scoreResponse
correctResponse
scoreResponseForStaircase

maxNumResponses
recordDefaultResponse
registerTrigger
autoResponse
autoResponseLatency

All elements
start
end

startBuffer
endBuffer

syncExperiment
preload
vary
staircase

All objects
info
report

fontName

Default: Arial

A string setting font. See Psychtoolbox Screen('TextFont') for more information on font names.

fontSize

Default: 0.7 deg

This sets font height (deg). Specifically it sets height of the "em box" for the font. Typically upper case characters are a little smaller than this. If you need more information, see Wikipedia https://en.wikipedia.org/wiki/Point_(typography) for a starting point.

color

Default: black

A 1×3 RGB vector with numbers between 0–1 setting font color.

lineSpacing

Default: 1.3-spaced

A number: 1 = single-spaced, 2 = double, 1.5 = 1 & 1/2, etc. This multiplies line height without affecting font size (set in fontSize above). 1 = each line's baseline is precisely fontSize distance from the next line's baseline.

boxSize
margin
boxColor

Default: boxSize = 12 deg width, 8 deg height
Default: margin = 0.4 deg
Default: boxColor = 90% white

boxSize sets text box size which the subject types in. This is a number for a square, or a vector [width height] for a rectangle (deg).

margin sets space between the box and text edges (deg).

boxColor is a 1×3 RGB vector with numbers between 0–1 setting text box color.

enterResponds

Default: pressing Enter records response

<cd>true<cd>/<cd>false<cd>: At default <cd>true<cd>, the subject presses Enter to submit the text they have typed as a response (and at default maxNumResponses = 1 this ends the element). In this mode the subject can type one line of text (possibly wrapping). Or <cd>false<cd> = pressing Enter starts a new line instead, and clicking any mouse button records response. In this mode the subject can type multiple lines of text.

recordNumeric

Default: response can be anything, recorded as string

<cd>true<cd>/<cd>false<cd>: <cd>true<cd> = record response as numeric data type, not string. The subject must input text that is a single number. If they don't, the element beeps and doesn't allow the response. <cd>false<cd> = allow any text and record as string data type.

fileName
numberFile
minNumDigitsInFileName

Default: fileName = don't save to file
Default: numberFile = automatically number files
Default: minNumDigitsInFileName = 1

fileName is a string setting name for the text file to save the input text to. If you include a path, it will save there, and make the folder if it doesn't exist. If you don't, it will save in the MATLAB current folder. Default = don't save to file, but input is still recorded in record property response.

If you set fileName:

numberFile = <cd>true<cd>/<cd>false<cd>: If = <cd>true<cd> (default), the element adds a number to file name starting at 1 and incrementing as needed to not change existing files. This means if you have multiple textInput elements in an experiment, you can set fileName the same for all of them (e.g. text.txt) and they will write different files numbered in the order they run in (e.g. text1.txt, text2.txt, text3.txt, ...). If you set numberFile = <cd>false<cd> then the element will not add a number and instead will append to any existing file with the specified name.

minNumDigitsInFileName sets the minimum number of digits to use for numbering files. e.g. 3 → text001.txt, text002.txt, text003.txt, ...

See also record properties fileName_r, n_file below.

n_device

Default: default keyboard

If you want to narrow down which device to listen to, you can set a HID device number here. Use Psychtoolbox functions GetKeyboardIndices or PsychHID('Devices') to see available device numbers.

Adjustable properties

You can vary or allow the subject to adjust the following properties of an object of this type when it's running. If you need to make other properties adjustable, you can edit the element type code—see Element Type Programming Manual.

Adjustable properties

Adjustable properties

position
nn_eyes
rotation
colorMask
alpha
intensity
contrastMult
drawCodeVars

(None)

(None)

Input properties
Record properties

PsychBench uses record properties to record information during experiments. You can't set record properties but you can see them in experiment results using input property report.

textInput
elements (see below)

fileName_r
n_file

All response handler elements
response
responseScore
responseTime
responseLatency
d_responseTime
numResponses

All elements
startTime
endTime
duration
n_startFrame
n_endFrame
startLatencyBufferable
endLatencyBufferable

trigger
triggerTime
d_triggerTime
numTriggers

syncTime

fileName_r
n_file

fileName_r is a string recording name of the file written to. This includes number added if numberFile = <cd>true<cd>.

n_file records the number added (numeric) if numberFile = <cd>true<cd>.