# How to adress the Label that shows a TextEditor inside of textEditorReturnKeyPressed?

**URL:** <https://forum.juce.com/t/how-to-adress-the-label-that-shows-a-texteditor-inside-of-texteditorreturnkeypressed/27297>\
**Category:** Audio Plugins\
**Created:** [April 18, 2018, 3:12pm UTC](https://forum.juce.com/t/how-to-adress-the-label-that-shows-a-texteditor-inside-of-texteditorreturnkeypressed/27297 "2018-04-18T15:12:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rollo](https://avatars.discourse-cdn.com/v4/letter/r/e9bcb4/32.png) [@rollo](https://forum.juce.com/u/rollo)\
**Post date:** [April 18, 2018, 3:12pm UTC](https://forum.juce.com/t/how-to-adress-the-label-that-shows-a-texteditor-inside-of-texteditorreturnkeypressed/27297/1 "2018-04-18T15:12:39Z")

</div>

Hello Juce-people,  
I’m relatively new to Juce and am stuck for the first time:

I attempt to create an audio plugin and I have a number of Labels which are editable.  
User entry should be limited to a range Integers (f.e. 0-60) and if the user enters something else the label should show the value it had before the edit.  
My attempt:

```
void GUI::editorShown(Label* labelThatShowsEditor, TextEditor& textEditorThatIsShown)

 {
    labelTextEditor = &textEditorThatisShown;
    if(labelThatShowsEditor == Label1)
    {
        Duration1 = std::stoi(textEditorThatisShown.getText().toStdString());
    }
    else if(labelThatShowsEditor == Label2)
    {
        Duration2 = std::stoi(textEditorThatisShown.getText().toStdString());
    }
}

```

So I store the momentary values in the variables Duration1 and Duration2 and the adress of the Texteditor in labelTextEditor.

Then i want to check inside textEditorReturnKeyPressed:

```
void GUI::textEditorReturnKeyPressed (TextEditor& textEditor)
{
    if(&textEditor == labelTextEditor)
    {
        String text = textEditor.getText();
        if(Helper::isInt(text))
        {
            //check for range
            //assign it to the "parent" label's text
        }
    }
}

```

Any advice on how to do that correctly?  
Thanks!

---

<div class="post-metadata">

**Author:** ![godwincharan](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/godwincharan/32/213_2.png) [@godwincharan](https://forum.juce.com/u/godwincharan)\
**Post date:** [April 18, 2018, 5:48pm UTC](https://forum.juce.com/t/how-to-adress-the-label-that-shows-a-texteditor-inside-of-texteditorreturnkeypressed/27297/2 "2018-04-18T17:48:57Z")

</div>

There is also a

> virtual void labelTextChanged (Label \*labelThatHasChanged)=0

You can use this instead of textEditorReturnKeyPressed
