How to do a bidirectional link for Slider and SpinBox controls?

75 Views Asked by At

I'm trying to link two common controls in the GUI, a Slider and a SpinBox. They are from a Python library for the Blackmagic Fusion software. It happen that in the way that I'm trying it seems are overriding the Slider control with SpinBox value.

Here the available events for these two items

Slider: ValueChanged, SliderMoved, ActionTriggered, SliderPressed, SliderRelease, RangeChanged,

SpinBox: EditingFinished, ValueChanged

 # GUI 
 dlg = disp.AddWindow({'ID': 'myWin', 'WindowTitle': 'myWin', 'Geometry': [ 400, 100, 230, 400 ],},
 [  
     ui.Slider({ 'ID': 'mySlider', 'Events': { 'SliderMoved': True, 'Activated': True } }),
     ui.SpinBox({ 'ID': 'mySpinBox' }),
 ])

 itm = dlg.GetItems()

 # Updates the Spin value when moves the Slider
 def _func(ev):
     var = ev['Value']
     itm['mySpinBox'].Value = var
 dlg.On.mySlider.SliderMoved = _func

 # Updates thed Slider position when SpinBox value is changed
 def _func(ev):
     itm['mySlider'].Value = itm['mySpinBox'].Value 
 dlg.On.mySpinBox.ValueChanged = _func
0

There are 0 best solutions below