Hi all,
We are having the following issue with the slider and trying to get it to be recognised as “read only” in Pavlovia. Have tried multiple things to find a solution but have been unsuccessful so far.
Any insight or suggestions would be super helpful.
Thanks,
Laura
What is the issue (in short): Using the “readOnly” check box in Builder for slider correctly makes the slider “read only” in PsychoPy but not in Pavlovia.
What are we using: Used Builder first. Have tried to solve the issue by using javascript in the coder (in GitHub for opacity, too). These are described below.
PsychoPy version/Operating System/Browsers: v2023.1.2 in Windows 10 (to my knowledge is the most recent) but the issue was present in earlier versions. Browsers tried: Chrome, Firefox, Edge.
Solution we are after: To either make the slider read only (how it works in PsychoPy) or to make the marker disappear (opacity = 0 or size = 0/very small) so to the participant it looks like it is not collecting responses (we do not need the responses). We are using the slider to provide feedback to participants (using shapes as an answer marker on the slider and have no issues with this).
What we have tried
*Tried these solutions below in an experiment that only has a slider and the problems still exist.
-
The following threads (adapted to javascript where relevant):
** Slider setReadOnly not work
** Remove Slider Marker? -
And the following code in the coder:
feedback_slider.setReadOnly = true;
**Results for each of the above: Code completely ignored and no error message comes up.
- This code in Build Routine or Every Frame coder:
feedback_slider.setAttribute('readOnly', 'true')
**Result: *Error message “feedback_slider.setAttribute is not a function”
- Creating a new slider in coder and applying the code below under Begin Routine.
**Result: Code completely ignored (no error message comes up) for both “readOnly” and “marker.opacity”:
feedback_slider = new visual.Slider({
"win": psychoJS.window, "name": "feedback_slider", "startValue": null, "size": [1.0, 0.06], "pos": [0, (- 0.32)], "units": "height", "labels": [0, 5, 10, 15, 20], "ticks": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], "granularity": 1.0, "style": "rating", "styleTweaks": [], "opacity": null, "labelColor": "black", "markerColor": [0.0824, (- 0.6627), 0.7725], "lineColor": "black", "colorSpace": "rgb", "font": "Open Sans", "labelHeight": 0.05, "flip": false, "ori": 0.0, "depth": (- 1), "readOnly": true});
and
feedback_slider = new visual.Slider({
win: psychoJS.window, name: 'feedback_slider',
startValue: undefined,
size: [1.0, 0.06], pos: [0, (- 0.32)], ori: 0.0, units: 'height',
labels: [0, 5, 10, 15, 20], fontSize: 0.05, ticks: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
granularity: 1.0, style: ["RATING"],
color: new util.Color('black'), markerColor: new util.Color([0.0824, (- 0.6627), 0.7725]), markerOpacity: 0, lineColor: new util.Color('black'),
opacity: undefined, fontFamily: 'Open Sans', bold: true, italic: false, depth: -1,
flip: false, readOnly: true
});
-
The following solutions to change marker size (so it looks non-existant):
**Changing the slider marker size in Javascript - #13 by Rahim_Hashim
**Changing slider appearance in JS
**Result: When adding the code to the coder, it makes a new smaller marker but does not change the size of the original marker (Every Frame) OR changes colour of the marker but does not change the size (Begin Routine) -
Setting the marker position to be off-screen: moves the marker to the maximum rating (e.g., 20 if scale is 0-20) and makes it appear.
-
Other notes: Slider has appearance settings set to “constant”. When changed to “set every repeat” OR “set every frame” the following error appears: ReferenceError: colorSpace is not defined