issues with slider: slider value returns to zero

hi

i am having issues with a slider
i am using the event slider value changed
when i set the slider value in the widget with the mouse, its value changes to the correct value and i capture and use it in my function related to the event
but then its value immediately goes to zero again - it again triggers the value changed event and in the function its value is recorder (get) as zero

why would this be
it is not the first slider i am using but the first time this is occurring

thanks

How are you doing it - with the slider’s delegate?

but then its value immediately goes to zero again

When? Under regular circumstances, it would not. Any more details?

it again triggers the value changed

It sounds a bit like the script created a dependency loop, where we read a value off a slider, set process and its value and have the slider report back. At least, that’s what I got from the description.


As a rule of thumb, it’s not advised to query widgets directly for their data but rely on the built-in delegates (or wrap widgets and build your own). You may need to demonstrate the actual script / result.

it is an ordinary / plain slider on a “bigger” widget

and i am debugging / have breakpoints because obviously something is not going as planned

on the event graph i have the slider value change event and a function running from it

i have a breakpoint on the function

i check the slider value inside the function with a breakpoint

1st run it is fine

but then the event function that is referred to above and intended for the slider value change gets triggered again and the next / new slider value inside the function is zero

at first i thought it was bounce, but no
then i thought it was related to the slider max value, but i no longer think so
at this point i deleted the sliders and created new ones because i think i might have copied them from anothe widget

Does it mean it works as intended after all?

no, that was for debugging and the problem persists with the new ones too

will try switching to the event: on mouse capture end

but if i use the mouse capture end event i loose the dynamic value update nature

unless it jumps to zero because of / at point of mouse capture end

which would still be slightly weird

It’s unclear (to me) what you’re really doing - can’t help without seeing the actual code / script. If you need help, simplify it and demo.

lol

it works as intended when i use the slider on mouse capture lost event to get the slider value change rather than the slider value change event
still need to figure out why the slider value change would fire twice - it must be firing twice to trigger the slider value change function one more once
and i dont know why it would fire with the right value the first time and then fire with zero the second time

i see in a previous widget with sliders i combined and implemented both slider events: on value change and mouse capture lost

i think that is perhaps what kept a weird value at the end
and it gives both dynamism and stability

otherwise only using on mouse capture lost is also ok ish