Quantcast
Channel: Questions in topic: "selectiongrid"
Viewing all articles
Browse latest Browse all 94

Using selection grid to activate text boxes

$
0
0
Sorry if this is answered somewhere else but I cannot seem to find it. I am trying to create a selection grid and actually have the buttons on the grid create a box where the user can input text, depend on the box selected. Currently I do not know how to call apon each individual box that is created by the grid. Here is the code I am currently working on: using UnityEngine; using System.Collections; public class Buttons : MonoBehaviour { bool Name = false; bool Age = false; bool Gender = false; bool GMFCS = false; public int selGridInt; private string[] selStrings1 = new string[] { "Name", "Age", "Gender", "GMFCS" }; private string[] selStrings2 = new string[] { "Disability", "Type", "MACs level", "Intellectual Disability" }; private string[] selStrings3 = new string[] { "Environment", "Vision Impairment", "Glasses", "Epilepsy" }; private string[] selStrings4 = new string[] { "Clinician", "Save", "Exit", "Reset" }; public string stringToEdit = ""; private void OnGUI() { GUI.SelectionGrid(new Rect(25, 100, 1000, 50), selGridInt, selStrings1, 4); GUI.SelectionGrid(new Rect(25, 200, 1000, 50), selGridInt, selStrings2, 4); GUI.SelectionGrid(new Rect(25, 300, 1000, 50), selGridInt, selStrings3, 4); GUI.SelectionGrid(new Rect(25, 400, 1000, 50), selGridInt, selStrings4, 4); //GUILayout.Box(selStrings1[selGridInt]); //if (selGridInt == 0) //Debug.Log("Name"); if (selGridInt == 1) Debug.Log("Age"); if (selGridInt == 2) Debug.Log("Gender"); if (selGridInt == 3) Debug.Log("GMFCS"); // Name = true; //if (Name) //stringToEdit = GUI.TextArea(new Rect(0, 0, 200, 100), stringToEdit, 200); } }

Viewing all articles
Browse latest Browse all 94

Trending Articles