vAlign Images in lines of text

Ken Ray kray at sonsothunder.com
Mon Oct 17 17:05:45 EDT 2005


On 10/17/05 10:17 AM, "Todd Geist" <tg.lists at geistinteractive.com> wrote:

> Hello,
> 
> I used set imageSource to put a little Icon in a line of text.
> 
> What I get is both the Icon and the text aligned to the text base line
> 
> What I want is for the text to be centered on the Icon.
> 
> Is this possible?

Funny you should ask that, as I was just discussing this with Richard Gaskin
yesterday. 

The answer is "yes", you can use the little-known "textShift" property of
text to shift the image (or the text, your choice) above/below the baseline.

So supposing your icon is the first character of line 1 of a field, you can
do this:

  set the textShift of char 1 of field 1 to 3  -- go 3 pixels "down"

You can use negative numbers to shift stuff up. Play with it a bit to get
your bearings, but it can be a really useful feature.



Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list