Slider PageStep=0

I have a very small slider it is 105px wide, has a range of 1 to 7
I do NOT want the slider to move if the user clicks the track (ie PageStep), so I thought setting it to ZERO would do the trick
This is not the case… the slider still jumps if the user clicks the track
because this is a relatively small control, with a short range… this can cause unwanted results if they miss the thumb by a pixel or two.

LIVESCROLL is true … as I DO want changes to be reflected immediately when they move the thumb

Any ideas??? (OSX)

Detect if the value has change when the user clicked down and restore the value ?

If he clicks on the thumb the value shouldn’t change.

Cheers,
Guy.

I can see no way to (in code) tell where the user clicked (on the thumb which is ok, vs the track which is not ok)…

There is “valuechanged” and by then it is too late.

My main question is why PageStep is not honoring ZERO

Your main question is: “Any Ideas??? (OSX)”

Any idea on what ?

  1. PageStep = 0 does not answer your need ?
    Not an idea, just a fact: no, PageStep=0 does not answer your need.

  2. How to avoid a slider value change if the user click on the track ?
    There is a way to avoid Slider value change if user click on the track:
    a) Add a ‘m_old_value’ property on your Window.
    b) Set a ‘m_just_down’ Boolean property on your Window.
    c) In the Open Slider event, set m_old_value to the current slider value.
    d) In the MouseDown event of the Slider, set the ‘m_just_down’ property to True.
    c) In the ValueChanged event of the Slider, set this code:

If m_just_down = True Then If Me.Value <> m_old_value Then Me.Value = m_old_value End If m_just_down = False End If m_old_value = Me.Value

This will prevent the Slider to move if the user click on the track.

There is one issue though: If the user click down and hold without moving the mouse, there will be a repeated ValueChanged Event fired without a MouseDown. So the thumb will still move. You could detect this with additional code in the MouseMove event though.

Cheers,
Guy.

[quote=75277:@Dave S]I have a very small slider it is 105px wide, has a range of 1 to 7
I do NOT want the slider to move if the user clicks the track (ie PageStep), so I thought setting it to ZERO would do the trick
This is not the case… the slider still jumps if the user clicks the track
because this is a relatively small control, with a short range… this can cause unwanted results if they miss the thumb by a pixel or two.

LIVESCROLL is true … as I DO want changes to be reflected immediately when they move the thumb

Any ideas??? (OSX)[/quote]
Curious why you would allow them to only move it one way - that seems overly restrictive for no reason.
If I click the track and only move 1 step then why would that behave differently than moving it in any other way ?
More curious about why this restriction should exist at all.
And sounds like not making this arbitrary restriction would get rid of the issue entirely.

Replace the Slider with UpDownArrows?

Norman… for some reason clicking on the track close to the thumb causes the slider to jump around… I had the pagestep at 1, linestep at 1 and it causes problems. and since this causes a zoom on an image the visual result is quite obvious… If it were not for the fact that it only has 7 steps it would probably not be an issue.

Tim… unfortunatly arrows do not fit in the overal GUI design paradigm I have (ie. they’d look out of place)

incorrect. simply clicking dead center in the thumb causes it to jump (sometimes, not always)… and it shouldn’t

Tried this too… just freezes the slider if MouseDown returns TRUE, but then there is no way to reset FLAG because MOUSEUP requires MouseDown to return TRUE

MouseDown

flag=false

MouseDrag (assuming it would fire when moving thumb)

flag=true

ValueChanges (only accept value change if MouseDrag)

if flag then 
   .... do stuff
end if

Yeah, you’d have to use timer to detect when the mouse is released.

Well,

Not sure why you are assuming it wouldn’t work without trying it first.

Here is a working example:
http://www.radfac.com/download/SliderNoTrackClick.zip
(Only tested on Windows so far though.)

You can move the Thumb by clicking on it ad drag it but it won’t move if you click on the Track.

Is it not what you are after ?

Cheers,
Guy.

(btw: you can remove the MouseUp event, it is useless in my example.)

[quote=75277:@Dave S]I have a very small slider it is 105px wide, has a range of 1 to 7
I do NOT want the slider to move if the user clicks the track[/quote]

Slider.Enabled = False ?

That disables everything… I do want the thumb to work

Not sure why you are assuming I didn’t

[quote=75379:@Guy Rabiller]Here is a working example:
http://www.radfac.com/download/SliderNoTrackClick.zip
(Only tested on Windows so far though.)
[/quote]

And while that does work under Windows… it does NOT work under OSX (and YES I tried it on OSX 10.9 and Win7)

Ah yes,

There seems to be a Xojo bug on Mac: the MouseMove event is not fired when the mouse move after a MouseDown.

To bad…

Cheers,
Guy.