Starting a slidertrial without a cursor already in place


Author
Message
LTK
LTK
Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)
Group: Forum Members
Posts: 15, Visits: 72
I'd like to present a slider that doesn't already have the slider cursor in a particular position to avoid biasing the participant's responses. I can use /defaultresponse to place it at different points but I can't see a way to make it not show up in the first place, as entering numbers outside the range just puts it at the most extreme position within the range, and /defaultresponse = null just puts it in the middle. Is there any way to hide the cursor until a response is made?
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 105K
LTK - 6/25/2021
I'd like to present a slider that doesn't already have the slider cursor in a particular position to avoid biasing the participant's responses. I can use /defaultresponse to place it at different points but I can't see a way to make it not show up in the first place, as entering numbers outside the range just puts it at the most extreme position within the range, and /defaultresponse = null just puts it in the middle. Is there any way to hide the cursor until a response is made?

> Is there any way to hide the cursor until a response is made?

No, not with <slidertrial> or <slider>. Your only option would be to build something like a VAS using a standard <trial> element. E.g.

<defaults>
/ fontstyle = ("Arial", 2%, true, false, false, false, 5, 0)
</defaults>

<data>
/ columns = [subject, date, time, blockcode, trialcode, trialnum, latency, text.question.currentitem, expressions.vasscore]
</data>

<values>
/ question = 0
</values>

*** Response Scoring Routines ***
<expressions>
/ correctionvalue = (display.canvaswidth - shape.line.width) / 2
/ correctedscore = (trial.VisualAnalogueScale.responsex - expressions.correctionvalue) / shape.line.width * 100
/ vasscore = trimright(format("%.2f", expressions.correctedscore),"px")
</expressions>

*** Block Definition ***

<block VAS>
/ trials = [1-2=VisualAnalogueScale]
</block>

*** Trial Definitions ***

<trial VisualAnalogueScale>
/ ontrialbegin = [if (trial.showresponse.response != "change") values.question = list.questionitems.nextvalue]
/ stimulusframes = [1=clearscreen, question, leftanchor, rightanchor, line]
/ inputdevice = mouse
/ validresponse = (line)
/ branch = [trial.showresponse]
/ recorddata = false
</trial>

<trial showresponse>
/ stimulusframes = [1=clearscreen, question, leftanchor, rightanchor,line, X, change, submit]
/ inputdevice = mouse
/ validresponse = (change, submit)
/ branch = [if (trial.showresponse.response == "change") trial.visualanaloguescale else trial.record]
/ recorddata = false
</trial>

<trial record>
/ validresponse = (0)
/ trialduration = 0
</trial>


*** Scale Items ***
<shape line>
/ shape = rectangle
/ color = (0, 0, 0)
/ size = (700px, 6px)
/ position = (50, 75)
/ erase = false
</shape>

<text question>
/ items = ("Please indicate how hungry you feel right now by clicking on the scale at the appropriate point. Please ensure that you use the full range of the scale", "Please indicate how full you feel right now by clicking on the scale at the appropriate point.")
/ position = (50, 25)
/ size = (80%,20%)
/ select = values.question
/ erase = false
</text>

<list questionitems>
/ items = (1,2)
/ select = sequence
</list>

<text leftanchor>
/ items = ("Not at all")
/ position = (25%, 75%)
/ size = (50%, 10%)
/ erase = false
</text>

<text rightanchor>
/ items = ("Extremely")
/ position = (75%, 75%)
/ size = (50%, 10%)
/ erase = false
</text>

*** Response Indicator ***
<text X>
/ fontstyle = ("Arial", -35, true, false, false, false, 5, 0)
/ items = ("X")
/ txcolor = (255, 0, 0)
/ txbgcolor = (transparent)
/ hposition = (trial.VisualAnalogueScale.responsex / display.width) * 100
/ vposition = shape.line.vposition
/ erase = false
</text>

<text change>
/ items = ("CHANGE")
/ position = (40%, 90%)
</text>

<text submit>
/ items = ("SUBMIT")
/ position = (60%, 90%)
</text>
*** End Of File ***


LTK
LTK
Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)
Group: Forum Members
Posts: 15, Visits: 72
Dave - 6/25/2021

> Is there any way to hide the cursor until a response is made?

No, not with <slidertrial> or <slider>. Your only option would be to build something like a VAS using a standard <trial> element. E.g.

<defaults>
/ fontstyle = ("Arial", 2%, true, false, false, false, 5, 0)
</defaults>

<data>
/ columns = [subject, date, time, blockcode, trialcode, trialnum, latency, text.question.currentitem, expressions.vasscore]
</data>

<values>
/ question = 0
</values>

*** Response Scoring Routines ***
<expressions>
/ correctionvalue = (display.canvaswidth - shape.line.width) / 2
/ correctedscore = (trial.VisualAnalogueScale.responsex - expressions.correctionvalue) / shape.line.width * 100
/ vasscore = trimright(format("%.2f", expressions.correctedscore),"px")
</expressions>

*** Block Definition ***

<block VAS>
/ trials = [1-2=VisualAnalogueScale]
</block>

*** Trial Definitions ***

<trial VisualAnalogueScale>
/ ontrialbegin = [if (trial.showresponse.response != "change") values.question = list.questionitems.nextvalue]
/ stimulusframes = [1=clearscreen, question, leftanchor, rightanchor, line]
/ inputdevice = mouse
/ validresponse = (line)
/ branch = [trial.showresponse]
/ recorddata = false
</trial>

<trial showresponse>
/ stimulusframes = [1=clearscreen, question, leftanchor, rightanchor,line, X, change, submit]
/ inputdevice = mouse
/ validresponse = (change, submit)
/ branch = [if (trial.showresponse.response == "change") trial.visualanaloguescale else trial.record]
/ recorddata = false
</trial>

<trial record>
/ validresponse = (0)
/ trialduration = 0
</trial>


*** Scale Items ***
<shape line>
/ shape = rectangle
/ color = (0, 0, 0)
/ size = (700px, 6px)
/ position = (50, 75)
/ erase = false
</shape>

<text question>
/ items = ("Please indicate how hungry you feel right now by clicking on the scale at the appropriate point. Please ensure that you use the full range of the scale", "Please indicate how full you feel right now by clicking on the scale at the appropriate point.")
/ position = (50, 25)
/ size = (80%,20%)
/ select = values.question
/ erase = false
</text>

<list questionitems>
/ items = (1,2)
/ select = sequence
</list>

<text leftanchor>
/ items = ("Not at all")
/ position = (25%, 75%)
/ size = (50%, 10%)
/ erase = false
</text>

<text rightanchor>
/ items = ("Extremely")
/ position = (75%, 75%)
/ size = (50%, 10%)
/ erase = false
</text>

*** Response Indicator ***
<text X>
/ fontstyle = ("Arial", -35, true, false, false, false, 5, 0)
/ items = ("X")
/ txcolor = (255, 0, 0)
/ txbgcolor = (transparent)
/ hposition = (trial.VisualAnalogueScale.responsex / display.width) * 100
/ vposition = shape.line.vposition
/ erase = false
</text>

<text change>
/ items = ("CHANGE")
/ position = (40%, 90%)
</text>

<text submit>
/ items = ("SUBMIT")
/ position = (60%, 90%)
</text>
*** End Of File ***


Thanks, I suspected this would be necessary, but I figured I'd check. For an earlier version of this task I used your example VAS code from... wow, 12 years ago, but I ran into some problems there. My task is running in 4:3 aspect ratio which throws off the calculations that involve the mouse's x coordinate. I mitigated that by taking the y coordinate multiplied by 4/3 instead, which seemed to work for a scale of 0 to 100, but I actually wanted my scale to go from -100 to 100. I assumed I could do this by not making correctionvalue divide by 2 and multiplying correctedscore by 200 instead of 100, but that gave me a scale that went from -106 to 94. I figured this was due to a rounding error caused by multiplying by 4/3 early on, so I added 6 to correctedscore to compensate.

These adjustments made it work correctly on both the computers I tested it on but it seemed that for other people, their mouse click still didn't translate correctly to the same point on the scale, and I'm not sure why. I noticed that in your code here you use display.canvaswidth instead of display.width, which I hoped would not cause this issue, but changing the aspect ratio to 4:3 still results in the X appearing in a different place than I clicked. Do you have any ideas on how to solve this
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 105K
LTK - 6/28/2021
Dave - 6/25/2021

> Is there any way to hide the cursor until a response is made?

No, not with <slidertrial> or <slider>. Your only option would be to build something like a VAS using a standard <trial> element. E.g.

<defaults>
/ fontstyle = ("Arial", 2%, true, false, false, false, 5, 0)
</defaults>

<data>
/ columns = [subject, date, time, blockcode, trialcode, trialnum, latency, text.question.currentitem, expressions.vasscore]
</data>

<values>
/ question = 0
</values>

*** Response Scoring Routines ***
<expressions>
/ correctionvalue = (display.canvaswidth - shape.line.width) / 2
/ correctedscore = (trial.VisualAnalogueScale.responsex - expressions.correctionvalue) / shape.line.width * 100
/ vasscore = trimright(format("%.2f", expressions.correctedscore),"px")
</expressions>

*** Block Definition ***

<block VAS>
/ trials = [1-2=VisualAnalogueScale]
</block>

*** Trial Definitions ***

<trial VisualAnalogueScale>
/ ontrialbegin = [if (trial.showresponse.response != "change") values.question = list.questionitems.nextvalue]
/ stimulusframes = [1=clearscreen, question, leftanchor, rightanchor, line]
/ inputdevice = mouse
/ validresponse = (line)
/ branch = [trial.showresponse]
/ recorddata = false
</trial>

<trial showresponse>
/ stimulusframes = [1=clearscreen, question, leftanchor, rightanchor,line, X, change, submit]
/ inputdevice = mouse
/ validresponse = (change, submit)
/ branch = [if (trial.showresponse.response == "change") trial.visualanaloguescale else trial.record]
/ recorddata = false
</trial>

<trial record>
/ validresponse = (0)
/ trialduration = 0
</trial>


*** Scale Items ***
<shape line>
/ shape = rectangle
/ color = (0, 0, 0)
/ size = (700px, 6px)
/ position = (50, 75)
/ erase = false
</shape>

<text question>
/ items = ("Please indicate how hungry you feel right now by clicking on the scale at the appropriate point. Please ensure that you use the full range of the scale", "Please indicate how full you feel right now by clicking on the scale at the appropriate point.")
/ position = (50, 25)
/ size = (80%,20%)
/ select = values.question
/ erase = false
</text>

<list questionitems>
/ items = (1,2)
/ select = sequence
</list>

<text leftanchor>
/ items = ("Not at all")
/ position = (25%, 75%)
/ size = (50%, 10%)
/ erase = false
</text>

<text rightanchor>
/ items = ("Extremely")
/ position = (75%, 75%)
/ size = (50%, 10%)
/ erase = false
</text>

*** Response Indicator ***
<text X>
/ fontstyle = ("Arial", -35, true, false, false, false, 5, 0)
/ items = ("X")
/ txcolor = (255, 0, 0)
/ txbgcolor = (transparent)
/ hposition = (trial.VisualAnalogueScale.responsex / display.width) * 100
/ vposition = shape.line.vposition
/ erase = false
</text>

<text change>
/ items = ("CHANGE")
/ position = (40%, 90%)
</text>

<text submit>
/ items = ("SUBMIT")
/ position = (60%, 90%)
</text>
*** End Of File ***


Thanks, I suspected this would be necessary, but I figured I'd check. For an earlier version of this task I used your example VAS code from... wow, 12 years ago, but I ran into some problems there. My task is running in 4:3 aspect ratio which throws off the calculations that involve the mouse's x coordinate. I mitigated that by taking the y coordinate multiplied by 4/3 instead, which seemed to work for a scale of 0 to 100, but I actually wanted my scale to go from -100 to 100. I assumed I could do this by not making correctionvalue divide by 2 and multiplying correctedscore by 200 instead of 100, but that gave me a scale that went from -106 to 94. I figured this was due to a rounding error caused by multiplying by 4/3 early on, so I added 6 to correctedscore to compensate.

These adjustments made it work correctly on both the computers I tested it on but it seemed that for other people, their mouse click still didn't translate correctly to the same point on the scale, and I'm not sure why. I noticed that in your code here you use display.canvaswidth instead of display.width, which I hoped would not cause this issue, but changing the aspect ratio to 4:3 still results in the X appearing in a different place than I clicked. Do you have any ideas on how to solve this

<defaults>
/ fontstyle = ("Arial", 2%, true, false, false, false, 5, 0)
/ canvasaspectratio = (4,3)
</defaults>

<data>
/ columns = [subject, date, time, blockcode, trialcode, trialnum, latency, text.question.currentitem, expressions.vasscore]
</data>

<values>
/ question = 0
</values>

*** Response Scoring Routines ***
<expressions>
/ correctionvalue = (display.canvaswidth - shape.line.width) / 2
/ correctedscore = ((trial.VisualAnalogueScale.responsex - expressions.correctionvalue) / shape.line.width * 200)-100
/ vasscore = trimright(format("%.2f", expressions.correctedscore),"px")
</expressions>

*** Block Definition ***

<block VAS>
/ trials = [1-2=VisualAnalogueScale]
</block>

*** Trial Definitions ***

<trial VisualAnalogueScale>
/ ontrialbegin = [if (trial.showresponse.response != "change") values.question = list.questionitems.nextvalue]
/ stimulusframes = [1=clearscreen, question, leftanchor, rightanchor, line]
/ inputdevice = mouse
/ validresponse = (line)
/ branch = [trial.showresponse]
/ recorddata = false
</trial>

<trial showresponse>
/ stimulusframes = [1=clearscreen, question, leftanchor, rightanchor,line, X, change, submit]
/ inputdevice = mouse
/ validresponse = (change, submit)
/ branch = [if (trial.showresponse.response == "change") trial.visualanaloguescale else trial.record]
/ recorddata = false
</trial>

<trial record>
/ validresponse = (0)
/ trialduration = 0
</trial>


*** Scale Items ***
<shape line>
/ shape = rectangle
/ color = (0, 0, 0)
/ size = (700px, 6px)
/ position = (50, 75)
/ erase = false
</shape>

<text question>
/ items = ("Please indicate how hungry you feel right now by clicking on the scale at the appropriate point. Please ensure that you use the full range of the scale", "Please indicate how full you feel right now by clicking on the scale at the appropriate point.")
/ position = (50, 25)
/ size = (80%,20%)
/ select = values.question
/ erase = false
</text>

<list questionitems>
/ items = (1,2)
/ select = sequence
</list>

<text leftanchor>
/ items = ("Not at all")
/ position = (25%, 75%)
/ size = (50%, 10%)
/ erase = false
</text>

<text rightanchor>
/ items = ("Extremely")
/ position = (75%, 75%)
/ size = (50%, 10%)
/ erase = false
</text>

*** Response Indicator ***
<text X>
/ fontstyle = ("Arial", -35, true, false, false, false, 5, 0)
/ items = ("X")
/ txcolor = (255, 0, 0)
/ txbgcolor = (transparent)
/ hposition = 100pct*(trial.VisualAnalogueScale.responsex / display.canvaswidth)
/ vposition = shape.line.vposition
/ erase = false
</text>

<text change>
/ items = ("CHANGE")
/ position = (40%, 90%)
</text>

<text submit>
/ items = ("SUBMIT")
/ position = (60%, 90%)
</text>
*** End Of File ***


should work.
LTK
LTK
Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)Associate Member (215 reputation)
Group: Forum Members
Posts: 15, Visits: 72
Dave - 6/28/2021
LTK - 6/28/2021
Dave - 6/25/2021

> Is there any way to hide the cursor until a response is made?

No, not with <slidertrial> or <slider>. Your only option would be to build something like a VAS using a standard <trial> element. E.g.

<defaults>
/ fontstyle = ("Arial", 2%, true, false, false, false, 5, 0)
</defaults>

<data>
/ columns = [subject, date, time, blockcode, trialcode, trialnum, latency, text.question.currentitem, expressions.vasscore]
</data>

<values>
/ question = 0
</values>

*** Response Scoring Routines ***
<expressions>
/ correctionvalue = (display.canvaswidth - shape.line.width) / 2
/ correctedscore = (trial.VisualAnalogueScale.responsex - expressions.correctionvalue) / shape.line.width * 100
/ vasscore = trimright(format("%.2f", expressions.correctedscore),"px")
</expressions>

*** Block Definition ***

<block VAS>
/ trials = [1-2=VisualAnalogueScale]
</block>

*** Trial Definitions ***

<trial VisualAnalogueScale>
/ ontrialbegin = [if (trial.showresponse.response != "change") values.question = list.questionitems.nextvalue]
/ stimulusframes = [1=clearscreen, question, leftanchor, rightanchor, line]
/ inputdevice = mouse
/ validresponse = (line)
/ branch = [trial.showresponse]
/ recorddata = false
</trial>

<trial showresponse>
/ stimulusframes = [1=clearscreen, question, leftanchor, rightanchor,line, X, change, submit]
/ inputdevice = mouse
/ validresponse = (change, submit)
/ branch = [if (trial.showresponse.response == "change") trial.visualanaloguescale else trial.record]
/ recorddata = false
</trial>

<trial record>
/ validresponse = (0)
/ trialduration = 0
</trial>


*** Scale Items ***
<shape line>
/ shape = rectangle
/ color = (0, 0, 0)
/ size = (700px, 6px)
/ position = (50, 75)
/ erase = false
</shape>

<text question>
/ items = ("Please indicate how hungry you feel right now by clicking on the scale at the appropriate point. Please ensure that you use the full range of the scale", "Please indicate how full you feel right now by clicking on the scale at the appropriate point.")
/ position = (50, 25)
/ size = (80%,20%)
/ select = values.question
/ erase = false
</text>

<list questionitems>
/ items = (1,2)
/ select = sequence
</list>

<text leftanchor>
/ items = ("Not at all")
/ position = (25%, 75%)
/ size = (50%, 10%)
/ erase = false
</text>

<text rightanchor>
/ items = ("Extremely")
/ position = (75%, 75%)
/ size = (50%, 10%)
/ erase = false
</text>

*** Response Indicator ***
<text X>
/ fontstyle = ("Arial", -35, true, false, false, false, 5, 0)
/ items = ("X")
/ txcolor = (255, 0, 0)
/ txbgcolor = (transparent)
/ hposition = (trial.VisualAnalogueScale.responsex / display.width) * 100
/ vposition = shape.line.vposition
/ erase = false
</text>

<text change>
/ items = ("CHANGE")
/ position = (40%, 90%)
</text>

<text submit>
/ items = ("SUBMIT")
/ position = (60%, 90%)
</text>
*** End Of File ***


Thanks, I suspected this would be necessary, but I figured I'd check. For an earlier version of this task I used your example VAS code from... wow, 12 years ago, but I ran into some problems there. My task is running in 4:3 aspect ratio which throws off the calculations that involve the mouse's x coordinate. I mitigated that by taking the y coordinate multiplied by 4/3 instead, which seemed to work for a scale of 0 to 100, but I actually wanted my scale to go from -100 to 100. I assumed I could do this by not making correctionvalue divide by 2 and multiplying correctedscore by 200 instead of 100, but that gave me a scale that went from -106 to 94. I figured this was due to a rounding error caused by multiplying by 4/3 early on, so I added 6 to correctedscore to compensate.

These adjustments made it work correctly on both the computers I tested it on but it seemed that for other people, their mouse click still didn't translate correctly to the same point on the scale, and I'm not sure why. I noticed that in your code here you use display.canvaswidth instead of display.width, which I hoped would not cause this issue, but changing the aspect ratio to 4:3 still results in the X appearing in a different place than I clicked. Do you have any ideas on how to solve this

<defaults>
/ fontstyle = ("Arial", 2%, true, false, false, false, 5, 0)
/ canvasaspectratio = (4,3)
</defaults>

<data>
/ columns = [subject, date, time, blockcode, trialcode, trialnum, latency, text.question.currentitem, expressions.vasscore]
</data>

<values>
/ question = 0
</values>

*** Response Scoring Routines ***
<expressions>
/ correctionvalue = (display.canvaswidth - shape.line.width) / 2
/ correctedscore = ((trial.VisualAnalogueScale.responsex - expressions.correctionvalue) / shape.line.width * 200)-100
/ vasscore = trimright(format("%.2f", expressions.correctedscore),"px")
</expressions>

*** Block Definition ***

<block VAS>
/ trials = [1-2=VisualAnalogueScale]
</block>

*** Trial Definitions ***

<trial VisualAnalogueScale>
/ ontrialbegin = [if (trial.showresponse.response != "change") values.question = list.questionitems.nextvalue]
/ stimulusframes = [1=clearscreen, question, leftanchor, rightanchor, line]
/ inputdevice = mouse
/ validresponse = (line)
/ branch = [trial.showresponse]
/ recorddata = false
</trial>

<trial showresponse>
/ stimulusframes = [1=clearscreen, question, leftanchor, rightanchor,line, X, change, submit]
/ inputdevice = mouse
/ validresponse = (change, submit)
/ branch = [if (trial.showresponse.response == "change") trial.visualanaloguescale else trial.record]
/ recorddata = false
</trial>

<trial record>
/ validresponse = (0)
/ trialduration = 0
</trial>


*** Scale Items ***
<shape line>
/ shape = rectangle
/ color = (0, 0, 0)
/ size = (700px, 6px)
/ position = (50, 75)
/ erase = false
</shape>

<text question>
/ items = ("Please indicate how hungry you feel right now by clicking on the scale at the appropriate point. Please ensure that you use the full range of the scale", "Please indicate how full you feel right now by clicking on the scale at the appropriate point.")
/ position = (50, 25)
/ size = (80%,20%)
/ select = values.question
/ erase = false
</text>

<list questionitems>
/ items = (1,2)
/ select = sequence
</list>

<text leftanchor>
/ items = ("Not at all")
/ position = (25%, 75%)
/ size = (50%, 10%)
/ erase = false
</text>

<text rightanchor>
/ items = ("Extremely")
/ position = (75%, 75%)
/ size = (50%, 10%)
/ erase = false
</text>

*** Response Indicator ***
<text X>
/ fontstyle = ("Arial", -35, true, false, false, false, 5, 0)
/ items = ("X")
/ txcolor = (255, 0, 0)
/ txbgcolor = (transparent)
/ hposition = 100pct*(trial.VisualAnalogueScale.responsex / display.canvaswidth)
/ vposition = shape.line.vposition
/ erase = false
</text>

<text change>
/ items = ("CHANGE")
/ position = (40%, 90%)
</text>

<text submit>
/ items = ("SUBMIT")
/ position = (60%, 90%)
</text>
*** End Of File ***


should work.

That was much simpler than I was expecting. Thank you!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search