What's new

Stopping a slider, which is already being dragged?

olmerk

Active Member
I want to stop a slider at a certain position while it’s being dragged. Tried this method:

on ui_control (slider)
if (<condition>)
slider:=fixed_value
end if
end on

In this case slider jitters back and forth between mouse cursor and fixed_value, which is not fancy.

Also tried to cover the slider with a transparent button when if (<condition>) happens, but the slider keeps being dragged, even covered. Only when I unlclicked it, it gets covered and non-active, so to speak.

Any ideas what else can be done? Thanks!
 
Any ideas what else can be done?
Yeah, don't try to stop it, just let it rip.

Alright, if this is really needed (and i could see it not being a requirement), there are a number of things to try.

The z layer method should work. Use another control (another slider) if the z layer method isn't working for you.

Another solution could be, create a label that uses the same image as the slider.
When the condition you need is active, hide the slider and show the label.
(just remember to update the label's picture state based on the slider's value.).

EDIT: Reading your post again, i hope i didn't get it wrong and you're not actually trying to stop a slider while it's being dragged, but simply create a condition so it remains at a fixed value, as your code seems to imply.

Cheers
 
Another solution could be, create a label that uses the same image as the slider.
When the condition you need is active, hide the slider and show the label.
(just remember to update the label's picture state based on the slider's value.).

Good idea. But I suppose I can't substitute this label back with the slider...
 
Last edited:
There is an effective way to stop sliders!

Have a ui_menu anywhere on your UI and change an item's visibility when it reaches a value. Make the menu invisible so the user doesn't see it obviously.

Your mouse will "let go" of the slider prematurely and it will stop moving. This is actually a bug we discovered trying to make scrollbars. When you change menu item visibility, the Kontakt GUI processing seems to disengage the mouse drag on sliders.
 
Good idea. But I suppose I can't substitute this label back with the slider...
Is the plan just blocking the slider when a condition is met?
When the condition is not met, the label is hidden, the slider is shown again.

There is an effective way to stop sliders!
Yeah, i wouldn't keep doing that.
If the menu system is updated, it could effectively break this trick.

@olmerk you actually don't need anything else.
Consider using "exit" combined with extremelly low drag mouse behaviour settings when you don't want the slider to move. (restore the mouse behaviour when you want to free it).
 
Is the plan just blocking the slider when a condition is met?
When the condition is not met, the label is hidden, the slider is shown again.

How is he to bring the slider back when the label is shown? He can't change the value to change the condition.
 
Isn't the condition that decides this outside the slider?
Maybe i didn't understand the original purpose afterall.

In any case, here's the proof of concept for my second suggestion:

Code:
on init
    declare ui_slider $slider(0,1000000)
    declare ui_button $button
end on

function block
    if($button = 1)
        $slider := 500000
        set_control_par(get_ui_id($slider), $CONTROL_PAR_MOUSE_BEHAVIOUR,1)
        exit
    else
        set_control_par(get_ui_id($slider), $CONTROL_PAR_MOUSE_BEHAVIOUR,1000)
    end if
end function

on ui_control($slider)
    call block
end on

on ui_control($button)
    call block
end on
 
In any case, here's the proof of concept for my second suggestion:
This trick is even smarter!) But like previous suggestions there is no way to drag slider again without triggering something outside it , e.g. unpressing button. Let me clarify what I need.

The task is to link two mixer faders. They can have different current values, when "Link" button is pressed, but they must sliding together. The issues is that one slider can hit the bottom, while I keep dragging down another one and in this moment the linkage gets broken. So I need to stop the slider I drag when another one reaches its min or max value. I would say it's kind of limiting slider's span, while it still stays interactive/dragable.
 
Ah, in that case i'd go with Neblix's suggestion if you want it hiccup free.
If that trick gets broken somewhere down the line, well... worry about it if/when that happens, i guess.

You could still use the label trick in a slightly different manner, but i think it would cause a noticeable hiccup when changing controls, and would not be 100% reliable.
 
I just tried menu-visibility-trick. Unfortunately, it works only once, i.e. when slider reaches the conditional limit (say if (slider=64)), the mouse cursor slips off nicely. But after that I can drag the slider beyond the limit. I check the slider values, the slip-off happens a bit after (depends on the cursor speed) and thus the slider is over-dragging inertly.
 
Alright, i just thought of a better method (that i used before... so this should have been my first suggestion).

- Just make the slider a transparent image.
- Use a label to emulate the slider's appearance.
- Link the label picture state to the slider values.

Now you can create rules at will without worrying about twitching.

Cheers.
 
Thanks a lot P.N.! The idea with transpaprent sliders worked. I made them being nailed to a fixed value and it doesn't matter as they jitter in this case. They are transparent and no one sees that.
 
Top Bottom