iPlug2 Forum

Multiline control labels

Hi, I’m just starting out with iplug2. So far I’m really impressed with the work done by Oli. I’m more of a hardware guy, with some experience in C and C#, but using the examples still allows me to get something working in just a few hours.

In any case, I was able to make a custom control to draw an envelope. The envelope has rates and levels such as decay rate and decay level. This all works fine, but I’d like to add sliders as well below the custom envelope control.

The problem I’m running in to is that the label names are quite long (e.g. decay rate). The label is basically wider than the vertical slider, so I can’t put multiple sliders next to eachother without overlapping text. Is there anyway to get multiline labels without creating a custom slider control? I know I can just create my own slider control and override the DrawLabel function, but this seems like a pretty common issue.
envelope control

We don’t have multi-line text in the IGraphics API but its not hard to use the lower level API directly. Here is an example with NanoVG:

1 Like

That’s weirdest pandgram, I’ve ever seen :thinking::slightly_smiling_face:

But nice, i was wondering about same thing myself the other day

Thanks for the help. Just to follow up on this: I opted not to mess with the low level API in the end. Instead, I ended up making a custom slider and overriding OnResize() and DrawLabel(). Because of the way label locations are determined (MakeRects in IGraphics) I had to make a modified copy of that one as well. I think two line labels are probably the most common use case, so I opted to split label lines with a ‘\n’. The rest of the control (slider) is resized to accommodate the bigger label.

Not the cleanest code, but it does what I need. https://gist.github.com/SammyPeiren/6c56db9d08fbb200acc3dcc89c9c531b