Im using a selection grid for a simple table that i need to display. the window theyre in is fixed size with a fixed horizontal internal window and a scrollable vertical one. When an entry is too long i need it to use a new line like, say, excel would. by default the end gets chopped off
![alt text][1]
The only option in guistyle that seemed to make sense was guistyle.wordwrap. however when i set this to true it has the desired effect by going to the next line when neccessary but it also creates a huge gap between each one
![alt text][2]
i cant even see another entry in the window to show how big the gap is! Any ideas how i can fix this? or is there something else that provides a grid like selectiongrid?
void OnGUI () {
windowRect = GUI.Window(0, windowRect, GuiFunc, "Record");
}
Rect insideWindow;
void GuiFunc(int id)
{
GUI.BeginGroup(insideWindow);
scrollPosition = GUILayout.BeginScrollView(scrollPosition, new GUIStyle());
GUILayout.SelectionGrid(0, gui, 2, listStyle);
GUILayout.EndScrollView();
if (GUILayout.Button("Close"))
{
mouse = false;
guiOn = false;
}
GUI.EndGroup();
GUI.DragWindow();
}
void Start () {
windowRect = new Rect(Screen.width/2 - 170, Screen.height/2 - 150, 340, 300);
insideWindow = new Rect(0, 0, 340, 1000);
listStyle.normal.textColor = Color.white;
listStyle.padding.left =
listStyle.padding.right =
listStyle.padding.top =
listStyle.padding.bottom = 4;
listStyle.fixedWidth = 150;
//listStyle.fixedHeight = 30;
//listStyle.stretchHeight = true;
listStyle.wordWrap = true;
listStyle.clipping = TextClipping.Overflow;
}
[1]: http://i301.photobucket.com/albums/nn77/theliam89/box1-1.png
[2]: http://i301.photobucket.com/albums/nn77/theliam89/box.png
↧