Tooltip being applied to wrong control

I am trying to add a “tooltip” to a control using the code below (inside the mLayoutFunc):

IBitmap bOutTrimKnob = pGraphics->LoadBitmap(OUTTRIMKNOB_FN, 101);
pGraphics->AttachControl(new IKnobControl(IRECT(368, 221, bOutTrimKnob), bOutTrimKnob, kOutTrimControl, KnobText));
pGraphics->GetControl(kOutTrimControl)->SetTooltip("Alt/CMD + right click to set to 0.0dB");

The control works properly but the tooltip shows up on a different control and not this one.

Debugger shows GetControl is returning the correct Idx (14 - kOutTrimControl) and that SetTooltip is applying the correct text - but it shows up on the UI over the wrong control.

Why? What is wrong here?

pGraphics->GetControl(kOutTrimControl)->SetTooltip("Alt/CMD + right click to set to 0.0dB");

The argument to GetControl() is the index of the control in the control stack, not the paramIdx. You could use GetControlWithTag() or alternatively, just do this…

pGraphics->AttachControl(new IKnobControl(IRECT(368, 221, bOutTrimKnob), bOutTrimKnob, kOutTrimControl, KnobText))->
SetTooltip("Alt/CMD + right click to set to 0.0dB");
1 Like

Got it. Thank you for the info!