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
PageStep = 0 does not answer your need ?
Not an idea, just a fact: no, PageStep=0 does not answer your need.
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.
[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.
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)
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)
[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]