How do developers make knob labels into values when mouseOver?

I feel like im doing something wrong with this, I have my knob setup with labels and values in the same bounds, when I mouse over the knob the value shows up however the label is under the value thus showing label and value, I would like the label to transform into the value like SurrealMachines or Outobugi

    ExampleKnob(const IRECT bounds, int param, const char* label)
        : IVKnobControl(bounds, param, label)
    {
        AttachIControl(this, label);
    }

    void OnMouseOver(float x, float y, const IMouseMod& mod)
    {
        if (mStyle.showValue && !mDisablePrompt)
            mValueMouseOver = mValueBounds.Contains(x, y);

        IKnobControlBase::OnMouseOver(x, y, mod);

        SetDirty(false);
    }

    void OnMouseDown(float x, float y, const IMouseMod& mod)
    {
        OnMouseOver(x, y, mod);

        mMouseDown = true;
        mMouseDragValue = GetValue();

        if (mod.A)
            SetValueToDefault();
        else
            GetUI()->HideMouseCursor();
    }

    void _DrawLabel(IGraphics& g, bool mouseOver)
    {
        mValueMouseOver = true;

        IBlend blend = mControl->GetBlend();

        g.DrawText(text, mLabelStr.Get(), mValueBounds, &BLEND_DST_IN);

        if (mouseOver)
            g.DrawText(text, mValueStr.Get(), mValueBounds, &BLEND_DST_OVER);
    }

and on void Draw i have _DrawLabel at the bottom of the drawing of knob.

The code was correct, however it wasn’t working because of the order of operations for the mouseOver
it should be:

if(mouseOver)
    g.DrawText(text, mValueStr.Get(), mValueBounds, &blend);
else
    g.DrawText(text, mLabelStr.Get(), mValueBounds, &blend);
1 Like