Centering Text On An Image

I'm trying to have a performance meter display text on a background image. I've only been able to right or left justify it. I can't seem to figure out how to set the mimimum size of a text object to be the same size as the background. If anyone has any tips I'd appreciate it.

Rod

#211222

Originally posted by CodF4ther@Sep 2 2004, 11:01 PM

I'm trying to have a performance meter display text on a background image.  I've only been able to right or left justify it.  I can't seem to figure out how to set the mimimum size of a text object to be the same size as the background.  If anyone has any tips I'd appreciate it.

Rod

<{POST_SNAPBACK}>

You'd probably need to do that in script yourself.

Each object has a Object.Width (how long it is) so you could find out the width of the label and the parent object and then say Object.left = where you need it to go.

#211749

Brad, thanks for the tip. I'm trying to mod the digidata IP display to show a barcode similar to the IP Serializer widgit for Konfab. I'll let you know how it goes.

#212222

Cool.

Yea use the Object.Width to get the width of a given object in pixels and then its center would be Object.Width/2

#212224

Got it working, the following script does the trick. Thanks again for the help. Here's a pic of the finished product (the ip is fake):

sept-9-2004-mini.jpg

Sub Object_OnScriptEnter
Object.SetTimer 1,10000
Object_OnTimer1
End Sub

'Called when the script is terminated
Sub Object_OnScriptExit
Object.KillTimer 1
End Sub

Sub Object_OnTimer1
Object.Left = (DesktopX.Object("DigiIPBack").Width - Object.Width) / 2
End Sub

#212226