# TextEditor OR Label ? Which to use

**URL:** <https://forum.juce.com/t/texteditor-or-label-which-to-use/6740>\
**Category:** General JUCE discussion\
**Created:** [April 19, 2011, 5:47am UTC](https://forum.juce.com/t/texteditor-or-label-which-to-use/6740 "2011-04-19T05:47:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gj9](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@gj9](https://forum.juce.com/u/gj9)\
**Post date:** [April 19, 2011, 5:47am UTC](https://forum.juce.com/t/texteditor-or-label-which-to-use/6740/1 "2011-04-19T05:47:53Z")

</div>

I have a series of texteditors where user can enter ONLY numeric values. And, based on certain conditions, these text editors get enabled or disabled.

However, when I disable a TextEditor, I do not get the same visual effect that we have when we disable a label !!!

1. If I use labels as UI for user to input values, I cannot validate if user has entered only numeric values, but when I disable the label, the text gets grayed out, and it appears disabled even visually to the user.

2. If I use TextEditor, I can easily restrict user from entering only numeric values by using setInputRestrictions(), but when I disable the texteditor, visually it does not appear to be disabled as the text within doest not get grayed out…

Can anybody help ?

regards,

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 19, 2011, 2:36pm UTC](https://forum.juce.com/t/texteditor-or-label-which-to-use/6740/2 "2011-04-19T14:36:09Z")

</div>

You can make a custom Label that uses any kind of texteditor you like - just overload Label::createEditorComponent(), call the parent class’s version of that method to create the editor, then tweak any flags on it that you need to before returning it.
