Best solution for TextField context menu?

Ooo… today is a difficult coding day. I could use some advice creating a context-menu text field. I tried modeling my code after Ahornberg’s Tape module and have something “working” which looks like this:

  struct LabelTextField : TextField {
  	DigitalProgrammer* module;
      box.size = Vec(20, 20); // this value doesn't seem to matter!?
      multiline = false;
  void appendContextMenu(Menu *menu) override
    menu->addChild(new LabelTextField());

Pretty bare minimum. I know that I’ll need to eventually add onChange and keep track of the entered value.

My question is: Is it possible to label the input, like this?


And if so, could someone steer me to some sample code?


I just came up with this, didn’t test it much but looks like could be in the right direction :

        // code inside appendContextMenu
        auto holder = new rack::Widget;
        holder->box.size.x = 101;
        holder->box.size.y = 20;
        auto lab = new rack::Label;
        lab->text = "Foo : ";
        lab->box.size = 49;
        auto textfield = new rack::TextField;
        textfield->box.pos.x = 50;
        textfield->box.size.x = 50;
1 Like

Wow! That’s awesome! I’ll try to flush that out for my needs. Thank you so much!

1 Like