Hello,
I have a matrix of custom sliders. I can see that the matrix is sending out messages in the form of:
/matrix.id/n_child.id child1.value
Is there any way that I can catch that message and reformat it to:
/matrix.id child1.value child2.value ...
Thanks in advance
I see know that the former above is the id. Still, I am curious if the latter is possible. Or if there is a way that a parent can detect a value change in a child.
It's possible with a matrix using its onValue
property:
send('ip:port', '/address', ...value)
It doesn't work with regular panel widgets.
Thanks. The onValue in the matrix is not being triggered. Is that because the slider is in a fragment that is in a panel?
Yes it only works with the matrix' direct children. There's currently no other mechanism exposed for containers to catch their children's value changes.
Thanks you. Is there a way to override the onValue of widgets in the fragment from the parent matrix?
It should be possible with the props
property:
JS{
var props = {} // overrides for matrix elements
props.props = {} // overrides for fragment content
props.props.onValue = `
console.log('slider ' + id + 'changed: ' + value)
`
return props
}