GUILayout Textfield not editable just static

Hey,

I am having trouble with my code with in each count it’s suppose to view the items as a editable textfield but instead it shows row text in the OnGUI method

here is the code
//Just some basic styles for the items

GUIStyle itemsContent = new GUIStyle (GUI.skin.textArea);
itemsContent.fontSize= 14;
Color32 textcolor = new Color32 (139,90,43,255);
itemsContent.normal.textColor = textcolor;
itemsContent.normal.background = null;
itemsContent.hover.textColor= textcolor;
GUI.backgroundColor = Color.clear;

//for loop for getting items and setting them for the user
for(cnt = 0 ; cnt <  numofLabels ; cnt++){

GUI.backgroundColor = Color.yellow;
				
itemTemp = items[cnt].getItms(); // array which has items from DB

				
GUI.Box(new Rect(610,200+(70*cnt),260,70),"Items List: " + GUILayout.TextField(itemTemp,25) +"

",itemsContent);

}

Thank you so much

GUILayout.TextField() can not be concatenated with strings **. You need to place the gui items next to each other manually.

E.g.

GUILayout.BeginArea(new Rect(610,200,260,70));
{
    GUILayout.BeginVertical();
    {
        for(cnt = 0 ; cnt <  numofLabels ; cnt++)
        {
            GUI.backgroundColor = Color.yellow;
            itemTemp = items[cnt].getItms();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Box("Items List: ", itemsContent);
                itemTemp = GUILayout.TextField(itemTemp,25);
            }
            GUILayout.EndHorizontal();
        }
        GUILayout.EndVertical();
}
GUILayout.EndArea();

*not tested

I’m not sure if itemTemp is a string or something else but I guess you want to store it again after it was edited.

@Edit
** actually the return value can be concatenated but the returned string isn’t stored then afaik