ITextControl as editable text?

Hi,

I just found this awesome new version of iPlug and I’m currently porting some VST3 SDK plugins to iPlug2.
At this point I need an editable text field where a user can enter a username.
Is there a way to make ITextControl behave just like ICaptionControl but then for ‘normal’ text?
I see the Placeholder component does something like this, but can the ITextControl be configured so it works like this?

Thanks!
PJ

Hi PJ!

something like this is what you need:

class ITextEditControl : public ITextControl {
  public:
  ITextEditControl(const IRECT& bounds, const char* str, const IText& text)
  : ITextControl(bounds, str, text) {
      mIgnoreMouse = false;
  }
  
  void OnMouseDown(float x, float y, const IMouseMod& mod) override {
      GetUI()->CreateTextEntry(*this, mText, mRECT, GetStr());
  }
  
  void OnTextEntryCompletion(const char* str, int valIdx) override {
      SetStr(str);
  }
};

Thanks Oli! I’m really amazed how easy it is to set things up with iPlug2 compared to the VST3 SDK. Great work!

2 Likes

added to IControl.h

2 Likes