I have a param and input for setting either “Min”, “Center” or “Max” for a range, and a push button or menu-item for changing between these 3 modes. When switching mode I want to change/update the tool tip that is shown when hoovering the mouse over the knob/input, and this works fine for my params (knobs):
if (minCntrMax.needsUpdate()) {
minCntrMax.updateActual();
std::string mode = "Center";
if (minCntrMax.act == minCntrMaxType::mcm_Min)
mode = "Minimum";
else if (minCntrMax.act == minCntrMaxType::mcm_Max)
mode = "Maximum";
ParamQuantity* pq = dynamic_cast<ParamQuantity*>(paramQuantities[MIN_CNTR_MAX_PARAM]);
if (pq) pq->name = mode + " (-10V to 10V)";
pq = dynamic_cast<ParamQuantity*>(paramQuantities[MIN_CNTR_MAX_TRIM_PARAM]);
if (pq) pq->name = mode + " CV-trim";
tooltipNeedsUpdate = true;
}
However I am not sure how I can change the tooltip that is shown for the input-port (“minCntrMaxInputPort”)
By “change tooltip”, I assume you mean you want to change the port name that appears in both the tooltip and the port context menu.
It isn’t much different than what you do for the parameters. It’s probably easier within the module instead of the widget, but I will show the code for the widget step method as you have it:
Note - for your parameter changes, you shouldn’t have to do any dynamic_cast() - they are already a ParamQuantity*. For example, you should be able to simply do the following:
paramQuantities[MIN_CNTR_MAX_PARAM]->name = mode + " (-10V to 10V)";
Thanks a lot @DaveVenom for both suggestions. Works like a charm and a lot easier than what I was trying to do, as I can now do all in process, and don’t need the Step() of the widget to do anything.