Open Ended Input in E-Prime
Cynthia J DeVore
devo0023 at tc.umn.edu
Fri May 30 15:43:41 UTC 2003
Georg,
I have discovered similar "features" and created a workaround. I took this
wholesale from a module I'm working on that supports multiple text entry
fields on a slide (I don't use the built in Echo) and so you may need to do
some fiddling with it. (In my implementation, in order to "echo" I allow
only one character for keyboard response and write it to the .text
associated with a text object.) The following code goes on the User Tab of
the Script. Then in an Inline, I have something like:
xxx = CleanedTextString(keyboardmask.RESP)
I'm on a hard deadline and regret that I cannot provide a better
explanation of the process.
Good luck.
Cynthia
Const ebLeftBrace = "{"
Const ebRightBrace = "}"
Const ebEnter = "{ENTER}"
Const ebBackSpace = "{BACKSPACE}"
Function ReplaceString(strSource As String, strFind As String, strReplace
As String) As String
Dim strFinal As String
Dim nPosNew As Integer
Dim nPos As Integer
nPos = 1
Do
nPosNew = InStr(nPos, strSource, strFind)
If nPosNew > 0 Then
'Append up to where we found
strFinal = strFinal & Mid(strSource, nPos, nPosNew
- nPos)
'Append the replaced string
strFinal = strFinal & strReplace
'Move past the item to find
nPos = nPosNew + Len(strFind)
Else
'Append the remainder of the string
strFinal = strFinal & Right(strSource,
Len(strSource) - (nPos - 1))
'No more need to search
nPos = 0
End If
Loop Until nPos < 1
ReplaceString = strFinal
End Function
Function CleanedTextString (strToChange As String) As String
Dim strOld As String
Dim strNew as String
Dim strFind as String
Dim strReplace as String
Dim nPos as integer
Dim nPosLeft as Integer
Dim nPosRight as Integer
Dim OldValue (1 to 2) as String
Dim NewValue (1 to 2) as String
OldValue (1) = "{SPACE}"
OldValue (2) = "{BACKSLASH}"
NewValue (1) = " "
NewValue (2) = chr(92)
strOld = strToChange
' Replace the special fields first
For i = 1 to 2
strFind = OldValue(i)
strReplace = NewValue(i)
strNew = ReplaceString(strOld, strFind, strReplace)
strOld = strNew
Next i
' Replace all other fields
nPos = 1
Do Until inStr(1,strOld,ebLeftBrace) = 0
nPosLeft = inStr(npos,strOld,ebLeftBrace)
nPosRight = inStr(nPosLeft,strOld,ebRightBrace)
If nPosRight - nPosLeft = 2 Then
strNew =
mid(strOld,(nPosLeft+1),1)&right(strOld,(len(strOld)-nPosRight))
If nPosLeft > 1 Then
strNew = left(strOld,(nPosLeft-1)) & strNew
End If
Else
strNew = right(strOld,(Len(strOld)-nPosRight))
If nPosLeft > 1 Then
strNew = left(strOld,(nPosLeft-1)) & strNew
End If
End If
strOld = strNew
Loop
CleanedTextString = strOld
End Function
At 04:48 PM 5/30/03 +0200, you wrote:
>Hello,
>
>I'm a long time MEL2 user who is currently making the transision to
>E-Prime.
>
>I'm working on my first study and I want create a computer
>questionnaire with open ended questions. To create an open ended
>question I load a slide with the instructions and black frame for the
>open ended input box.
>Then I add a TextDisplay which collects a keyboard response, that is
>in input masks I added the keybord as input device. Then I clicked on
>advanced in the response options and set a max count of 20, Flush
>Input Buffer to 'yes' and the Termination Response to {ENTER}. On the
>collection tab I set the reponse mode to 'alphanumeric' and process
>backspace to 'yes'. I also added a display on the screen in the echo
>tab, so that the subjects can see what they are typing.
>
>Now everything runs smoothly as long as you don't need to correct your
>input. When you type on the backspace the text on the screen
>disappears correctly. Unfortunately the maximum number of allowed
>characters is decreased instead of increase when I press the backspace
>key.
>So for example if I enter ten characters and then erase these ten
>characters again with backspace the screen will disappear because the
>20 characters maximum has been reached.
>
>This looks very much like a bug in E-Studio. Obviously control
>characters are registered as regular alphanumeric characters and are
>added to the text string. They should either be ignored or just
>perform the desired control, e.g. deleting a character from the screen
>and from the text variable.
>
>Is there any way to get E-Prime to perform the backspace operation
>correctly?
>
>I can probably come up with some E-Basic code to do open ended input
>with correct backspace processing, but it would be a lot easier if
>there was an E-Object that can also do this correctly.
>
>Does any of you have had similar problems or probably a good solution
>for that problem?
>
>Best regards,
> Georg
>
>
>==========================================================================
>
>Georg Odenthal (Dipl.-Psych.) University of Konstanz
>+49 (0)7531 88-2872 Department of Psychology
>odenthal at soz.psychologie.uni-konstanz.de Social Psychology and Motivation
>http://www.socpsych.uni-konstanz.de 78457 Konstanz, Germany
>
>==========================================================================
Cynthia J. DeVore
Graduate Student
University of Minnesota - Industrial/Organizational Psychology
devo0023 at tc.umn.edu
612-624-3601
Office hours for E-Prime Consultant:
http://online.psych.umn.edu/IS/Elliott160/Calendar/200305.htm
E-Prime @ U of MN http://online.psych.umn.edu/IS/Eprime/index.htm
More information about the Eprime
mailing list