Label Tutorial - Accessing Editor?

So I’m going through the JUCE tutorial and am stuck at the last part of The Label Class (under Interface Design)

Other customisations can be achieved by implementing the Label::onEditorShow helper object. For example, you could make the text italic when being edited like this:

inputText.onEditorShow = [this]
auto editorFont = editor.getFont();
editorFont.setItalic (true);
editor.setFont (editorFont);

The instruction asks to access a member variable named “editor” which exists in Juce_Label.h but understandably I’m getting an error because it is a private member variable.

Is there a way to get access to this editor variable? I’ve followed the tutorial exactly to the best of my abilities. This is probably a super basic question to ask but I am new to JUCE and any help would be much appreciated.

if that’s the Label’s textEditor, you want to call label.getCurrentTextEditor()

Assuming you have Label inputText; (I didn’t look at the tutorial)
You’d customize the label’s text editor’s font when it’s being edited like this:

Label inputText;
inputText.onEditorShow = [&inputText]()
    auto editorFont = inputText.getCurrentTextEditor()->getFont();

edit: I looked at the tutorial. It needs correcting.
cc: @jules @t0m @ed95

That did the trick! getCurrentTextEditor()->getFont() and setFont() works great. Thanks for replying.

And yeah I agree, its worth correcting the tutorial for when others come across this part.

Yep, will get that sorted out. Thanks!