I’m trying to create a CodeEditorComponent
in a very simple way, just like a TextEditorComponent
. But I find that it asserts, as the internal lines
array inside CodeDocument
is uninitialized. I can’t see anything in the documentation that gives me a solution. Can anybody help?
class MainComponent : public Component
{
public:
MainComponent() :
editor(CodeDocument(), nullptr)
{
setBounds(0, 0, 100, 100);
setWantsKeyboardFocus(true);
addAndMakeVisible(editor);
}
void resized() override
{
editor.setBounds(getLocalBounds().reduced(10));
}
private:
CodeEditorComponent editor;
};