| Reference | Downloads | Github

Disable mouse for the silder response and uses keyboard only

Would anyone help me with the silder response problem I have encountered recently with online experiment. I have searched in google for a while, but failed to find the answer. I appologize that if someone already solved this problem somewhere. If someone could point to a solution for me, that is much appreciated.

Description of the problem:
I used Wakecarter’s interactive silder demo and created a silder that allow the keyboard control (right/left keys).

However I found out, the mouse can also control the silder both online and in builder. I would like to disable mouse for the silder response. Is there a way to do that?

Thank you in advance!

Hello Catherine,

I am not sure whether this is sufficient but you could hide the mouse. See here for various ways to achieve that.

Best wishes Jens

If you are using the iSlider then try removing the following lines of code from Each Frame

# End routine with mouse
elif newRating > -999 and mouse.isPressedIn(marker):

# Move slider with mouse
elif slider_background.contains(mouse) and mouse.getPos()[slider_orientation] != mouseRec[slider_orientation]:
    newRating = round((mouseRec[0]/slider_width*(slider_ticks[-1]-slider_ticks[0])+(slider_ticks[0]+slider_ticks[-1])/2),slider_decimals)
    sliding = 0

For the other slider remove the following from slider_code Each Frame

elif slider.markerPos and mouse.isPressedIn(slider_shape):

# Move slider on hover
elif slider_shape.contains(mouse) and mouse.getPos()[slider_orientation] != mouseRec[slider_orientation]:
    sliding = 0

Hello JensBoelte,

Thank you very much for pointing out this. It worked with my paradigm!

Thank you Wakecarter for the responses. They are very helpful.