Originally, a slider can be rated by clicking any tick on it with its marker moved to corresponding position. Is it possible to make a slider only interactable by dragging the marker and prevent it from being rated by clicking the ticks?
Hi @Spenserark_Bottest, you can, it just means overwriting the click handling method of the slider. The following will work for a slider named “slider”. Add a code component and use the following in relevant tabs
# Begin Experiment def dragOnly(): click = bool(slider.mouse.getPressed()) xy = slider.mouse.getPos() if click: # Update current but don't set Rating (mouse is still down) # Dragging has to start inside a "valid" area (i.e., on the # slider), but may continue even if the mouse moves away from # the slider, as long as the mouse button is not released. if (slider.validArea.contains(slider.mouse, units=slider.units) and slider.markerPos is None): slider.markerPos = slider._posToRating(xy) # updates marker slider._dragging = True elif (slider.marker.contains(slider.mouse, units=slider.units) or slider._dragging): slider.markerPos = slider._posToRating(xy) # updates marker slider._dragging = True else: # mouse is up - check if it *just* came up if slider._dragging: slider._dragging = False if slider.markerPos is not None: slider.recordRating(slider.markerPos) return slider.markerPos else: # is up and was already up - move along return None slider._mouseStateXY = xy # Override slider method slider.getMouseResponses = dragOnly
Thank you for your help!
Is it possible to move the marker CONTINUOUSLY simply by moving the mouse (without clicking and dragging), OR press and hold keys, and record the continuous ratings?