Color control with ID

Hi,
I try to do a custom editor window.
I do the lot of the stuff but I’m actually blocked :/.

There is a way to get an element with its controlID.

My current test area is this one :

if ( currentEvent.button == 0  GUI.GetNameOfFocusedControl().Contains( "MyTextField_" ) )
{
       	int nHotValue = GUIUtility.hotControl;
       //...
}

In this test, I would color the background of the current control selected ( it’s a textfield ), but I don’t find a solution to get a reference on this control and apply some modifications on it.

There is a way to do this with a controlID ?
I know there is other solution as boolean value set to true when I detect the input on it, etc… but I would know if something is possible with controlID :slight_smile:

Thanks in advance for your anwsers.

ohh. do a search for .NextControlName() and how to use it. :slight_smile:

Edit: This looks interesting: http://forum.unity3d.com/threads/188202-Simple-dynamic-list-editor

I name all my textfield with the function .SetNextControlName(). I understand how it works (i think so). But the only thing I want to do was to keep the controlID value send by “GUIUtility.hotControl” (last control which has detected an input) and use a function like this one :
GetControlFromID() but sadly that kind of function doesn’t exist.

Maybe my question wasn’t so clear :/. But thanks for your link there is a lot of solution and lights in this topic !

I finally do a solution based on boolean link with controlID values cause it was more common to me.

I think your link will help me to do a cleaner solution because mine looks like complicated when I look the script from other topic.

Anyway thanks for your answer.