@JamesC So for those interested this is how I solved it in the end with a bit of AI help:
inline function onxypadControl(component, value) { local x = component.data.x; local y = component.data.y; local gainX = -40 + (60 * x); local gainY = -40 + (60 * (1 - y)); gains1[0].setAttribute(gains1[0].GainValue, gainX); gains1[1].setAttribute(gains1[1].GainValue, gainY); gains2[0].setAttribute(gains2[0].GainValue, gainX); gains2[1].setAttribute(gains2[1].GainValue, gainY); knbxy[0].setValue(x); knbxy[1].setValue(y); component.repaint(); }