Labels and TextEditors

If I create an editable label, and I click to enter text, the text in the editor moves to a different location. Usually it moves up, and left.

Labels create a TextEditor with Label::createEditorComponent()
The editor is created with default indents and border sizes.

Is this the issue? What is the best way to change those indent and border size values?

Many thanks!

look at the default implementation of createEditorComponent to see how it creates a TextEditor, and where it gets placed in Label::resized().
You can provide your own createEditorComponent if you subclass Label. same for TextEditor.

createEditorComponent creates a TextEditor, it’s the same dimensions as the Label, but it has hard coded default indents and border sizes… I’m not sure how to overcome them.

I did try overriding createEditorComponent() but it didn’t work.

make it return your custom TextEditor

TextEditor* MyCustomLabel::createEditorComponent()
Creates the TextEditor component that will be used when the user has clicked on the label.
Subclasses can override this if they need to customise this component in some way.
    return new MyCustomTextEditor( /* args */ );

struct MyCustomTextEditor : public TextEditor
    //customize whatever...

Looking into this further, I discovered that I really just wanted to be using a TextEditor component, not a Label. I didn’t realize I could do that, now I can style it correctly. Thank you for your help!