# Label Tutorial - Accessing Editor?

**URL:** <https://forum.juce.com/t/label-tutorial-accessing-editor/35803>\
**Category:** Getting Started\
**Created:** [October 22, 2019, 6:41am UTC](https://forum.juce.com/t/label-tutorial-accessing-editor/35803 "2019-10-22T06:41:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![azrulsaleh](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@azrulsaleh](https://forum.juce.com/u/azrulsaleh)\
**Post date:** [October 22, 2019, 6:41am UTC](https://forum.juce.com/t/label-tutorial-accessing-editor/35803/1 "2019-10-22T06:41:09Z")

</div>

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](https://docs.juce.com/master/classLabel.html#ae8e66977501dc15f678cc1b80fa218ce) 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.

 ![59%20PM](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/9/9f85938b58e0df88bf6cfd00a1e768b695ab0b1f.png)

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.

---

<div class="post-metadata">

**Author:** ![matkatmusic](https://avatars.discourse-cdn.com/v4/letter/m/dfb087/32.png) [@matkatmusic](https://forum.juce.com/u/matkatmusic)\
**Post date:** [October 22, 2019, 7:31am UTC](https://forum.juce.com/t/label-tutorial-accessing-editor/35803/2 "2019-10-22T07:31:08Z")

</div>

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:

```auto
Label inputText;
inputText.onEditorShow = [&inputText]()
{
    auto editorFont = inputText.getCurrentTextEditor()->getFont();
    editorFont.setItalic(true);
    inputText.getCurrentTextEditor()->setFont(editorFont);
};

```

edit: I looked at the tutorial. It needs correcting. [https://docs.juce.com/master/tutorial\_label.html](https://docs.juce.com/master/tutorial_label.html)  
cc: @jules @t0m @ed95

---

<div class="post-metadata">

**Author:** ![azrulsaleh](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@azrulsaleh](https://forum.juce.com/u/azrulsaleh)\
**Post date:** [October 22, 2019, 8:10am UTC](https://forum.juce.com/t/label-tutorial-accessing-editor/35803/3 "2019-10-22T08:10:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [October 22, 2019, 9:24am UTC](https://forum.juce.com/t/label-tutorial-accessing-editor/35803/4 "2019-10-22T09:24:33Z")

</div>

Yep, will get that sorted out. Thanks!
