How to make a scale slider

Hello PTB community,

I'm trying to make a slider for a simple scale where the user can see mouse movement ONLY in the horizontal axis (fixed y location on the horizontal scale).

In more detail:
When the scale appears, I want the cursor to appear as a short vertical line (aka slider) in the center of the horizontal scale.
When the user moves the mouse, the slider should move accordingly on the horizontal axis (without reflecting any changes in the vertical axis, i.e. it should stay on the scale)

I'm stuck on both changing the appearance of the cursor to a vertical line slider and on limiting the cursor's movement to the horizontal axis.

Here's what I've tried:

I can successfully place the cursor with SetMouse.

I tried ShowCursor to change the appearance of the cursor, but this only has a few named options and the numbered ones are not portable across OSs ("mapping of numbers to shapes is operating system dependent"), which I need. Any other ideas on how to change the cursor to a vertical line slider?

As for limiting the movement to horizontal, I couldn't find any PTB functions that seem to do this. I did find some workarounds in Matlab to make user GUIs, but it seems these can't be used with PTB's screen. Any ideas would be great!

I'm a still very new to PTB so thank you so much for your help!

Best,

Maia

Hide the cursor and draw it yourself, only using the x return value from get mouse. Then it doesn't matter if the y value varies.

On Aug 29, 2016 2:29 PM, "tootsieroll20@... [PSYCHTOOLBOX]" <PSYCHTOOLBOX@yahoogroups.com> wrote:

Hello PTB community,

I'm trying to make a slider for a simple scale where the user can see mouse movement ONLY in the horizontal axis (fixed y location on the horizontal scale).

In more detail:
When the scale appears, I want the cursor to appear as a short vertical line (aka slider) in the center of the horizontal scale.
When the user moves the mouse, the slider should move accordingly on the horizontal axis (without reflecting any changes in the vertical axis, i.e. it should stay on the scale)

I'm stuck on both changing the appearance of the cursor to a vertical line slider and on limiting the cursor's movement to the horizontal axis.

Here's what I've tried:

I can successfully place the cursor with SetMouse.

I tried ShowCursor to change the appearance of the cursor, but this only has a few named options and the numbered ones are not portable across OSs ("mapping of numbers to shapes is operating system dependent"), which I need. Any other ideas on how to change the cursor to a vertical line slider?

As for limiting the movement to horizontal, I couldn't find any PTB functions that seem to do this. I did find some workarounds in Matlab to make user GUIs, but it seems these can't be used with PTB's screen. Any ideas would be great!

I'm a still very new to PTB so thank you so much for your help!

Best,

Maia

Hi there,

I was wondering whether you managed to solve your issue. I am trying to do something similar and can only seem to generate a MatLab GUI as a scale slider that does not work in PTB.

Any suggestions would be very much appreciated.

Best,

Will