Gtk.Scale signal value versus drag-end?

Question in short: Does the Gtk.Scale widget have a drag-end signal, not a value-changed ?

I am using a gadget widget (slider) and according to the docs I have to use the value-changed signal to determine when the user changes the slider.

Now the user grabs the slider and drags it to the desired value. When they have completed , choosing their desired value (i.e. Finished drag and drop), I want to do some things.

However, the value-changed signal is emitted every time the value changes, including when the user is still in the process of dragging the slider to the desired value, so I get one of these signals for each value between the initial value and the final value.

This marks a significant delay in my program and all this is not necessary.

So - is there a way that I can listen to a signal that is triggered when the user has finished changing the value on the slider, as opposed to a signal that is triggered each time the value is changed?

At the moment, I am suppressing calls, waiting for some small amount of time before executing my code, responding only to the last value-changed signal that I receive during this period. This works fine, but I'm just wondering if there is a more suitable signal that I should listen to.

+4
source share
4 answers

Check out the gtk_range_set_update_policy() function. You want to set the policy to GTK_UPDATE_DISCONTINUOUS .

+3
source

You can use change-value instead. The second argument is Gtk.ScrollType . Comparing this with Gtk.ScrollType.JUMP should produce the desired result.

+2
source

There is no public API for this. I think your approach is great.

0
source

In GTK + 3 (at least), Scale inherits from Widget , which emits a button-release-event signal.

0
source

Source: https://habr.com/ru/post/1443628/


All Articles