# ITextControl as editable text?

**URL:** <https://iplug2.discourse.group/t/itextcontrol-as-editable-text/40>\
**Category:** Uncategorized\
**Created:** [28 March 2020 19:39 UTC](https://iplug2.discourse.group/t/itextcontrol-as-editable-text/40 "2020-03-28T19:39:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![E-Phonic](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@E-Phonic](https://iplug2.discourse.group/u/E-Phonic)\
**Post date:** [28 March 2020 19:39 UTC](https://iplug2.discourse.group/t/itextcontrol-as-editable-text/40/1 "2020-03-28T19:39:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [29 March 2020 01:52 UTC](https://iplug2.discourse.group/t/itextcontrol-as-editable-text/40/2 "2020-03-29T01:52:41Z")

</div>

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);
  }
};
```

---

<div class="post-metadata">

**Author:** ![E-Phonic](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@E-Phonic](https://iplug2.discourse.group/u/E-Phonic)\
**Post date:** [29 March 2020 04:13 UTC](https://iplug2.discourse.group/t/itextcontrol-as-editable-text/40/3 "2020-03-29T04:13:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [29 March 2020 16:28 UTC](https://iplug2.discourse.group/t/itextcontrol-as-editable-text/40/4 "2020-03-29T16:28:45Z")

</div>

added to IControl.h

> <https://github.com/iPlug2/iPlug2/commit/61a96c85288d04a7847870c67fa8b53d5620871f>
