Computer Science Canada

[GUI]Setting a Text Location in a Text Box??

Author:  nate [ Tue Jul 24, 2007 1:37 pm ]
Post subject:  [GUI]Setting a Text Location in a Text Box??

Quick Question:

Is it possible to set a location to text inside a text box in GUI?

For example: I want to line up all the information like a table, but it always comes out mixed up

Name------Ag--------Sex
Bob---------18---------M
Lilly---------19---------F
Chris--------17--------M

I tried taking the length of each name, and adding on the appropriate number of blank spaces (" ") so that the age of each person would be inline but because the letters are of different widths i'm finding that, especially with names with lots of i's and l's, that this method doesn't work.
Could you modify turings GUI, so that GUI.AddText could have an x, and y component? if so how would i do that (i kinda tried but didn't get it)

-Nate

Author:  Ultrahex [ Tue Jul 24, 2007 4:21 pm ]
Post subject:  Re: [GUI]Setting a Text Location in a Text Box??

1. The easiest way to make a table is make the TextBox use a monospaced font when you create the TextField and just do the spaces thing...
2. Another way to do is to use Font.Width() function and determine how many spaces is needed to line up or something like that (fair bit harder probably)
3. You could modify the TextBoxBodyClass .... but it seems like wayyy too much work for something simple

personally I'd do number one.

Just giving you some ideas.


: