Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Vile Smile on October 17, 2010, 03:33:00 pm

Title: Text Alignment?
Post by: Vile Smile on October 17, 2010, 03:33:00 pm
Is it possible to align text to the right or center?

Also, is it possible to determine the length of a string?
Title: Re: Text Alignment?
Post by: nemo on October 17, 2010, 03:34:34 pm
is this on the graphscreen or homescreen? and is it large text or small text?

both are possible, i'm just curious because small text would be difficult while large text on the homescreen would be relatively easy.

and yes, you can determine the length of a string
Title: Re: Text Alignment?
Post by: SirCmpwn on October 17, 2010, 03:34:53 pm
Length can be done with length(
As for aligning it, I can look into writing a method for you, but you'd have to calculate the pixel width of the text first.
Title: Re: Text Alignment?
Post by: Builderboy on October 17, 2010, 03:46:12 pm
With large font, aligning is a simple equation, but for small font, it gets a little more complicated.
Title: Re: Text Alignment?
Post by: meishe91 on October 17, 2010, 04:45:44 pm
Well wouldn't it only get hard with the small font when you branch away from the three pixel width?
Title: Re: Text Alignment?
Post by: Vile Smile on October 17, 2010, 06:12:00 pm
My goal is to display a score (integer), but it is aligned along the right side of the screen. How would I find the number of digits in the score?
Title: Re: Text Alignment?
Post by: meishe91 on October 17, 2010, 06:16:37 pm
Crap, I keep forgetting to check what section this is in :P I keep thinking this is all TI-BASIC :P

Anywho, you might be able to do it the way Sir said, with the length( command. But I'm not sure. I only know how I would do it in TI-BASIC.
Title: Re: Text Alignment?
Post by: Runer112 on October 17, 2010, 06:59:03 pm
Code: [Select]
.S=Score (or any other number to align right)
.T=Temp
.X=x position of text
.Y=y position of text
91→X
S→T
While T/10→T
X-4→X
End
Text(Y,X,S▸Dec)
Title: Re: Text Alignment?
Post by: Vile Smile on October 17, 2010, 08:04:13 pm
Thanks! Worked like a charm!