textfield text centering

BlitzPlus Forums/BlitzPlus Programming/textfield text centering

julianbury(Posted 2010) [#1]
HiYa Brains :-)

How can I center text in a text field gadget?

Sorry to bother you with this trivia, I'm polishing.

(^_^)


Sauer(Posted 2010) [#2]
I've never done this before but maybe you could use LSet and RSet to pad each line? Heres some psuedo code:

For each line in text field:
  pad=text_area_width - line_width
  line=LSet(line,pad/2)
  line=RSet(line,pad/2)

Output lines


Just an idea.


julianbury(Posted 2010) [#3]
Hi Sauer :-)

Thank you for that, I'll give it a try.
I was down to measuring the stringwidth and fitting the fieldsize to that!

(^_^)