itunes alternating lines

Trevor DeVore lists at mangomultimedia.com
Sun Oct 26 12:43:49 EDT 2008


On Oct 26, 2008, at 5:48 AM, Eric Chatonet wrote:

> Trevor's solution is of course very interesting but if you want a  
> straight and easy one, just make a pattern and lock the image.
> ...
>
> on ChangeFieldTextHeight pFld,pHeight,pPatternImage
>  lock screen
>  set the textHeight of pFld to pHeight
>  set the height of pPatternImage to pHeight * 2
>  set the backPattern of pFld to the backPattern of pFld
>  -- refreshes pattern
>  unlock screen
> end ChangeFieldTextHeight

While this is easy I would like to point out one of the differences  
between this technique and the one in my lesson. My handler creates an  
image that contains an offset value. This means that if you have two  
rows that are 18 pixels each and an offset of 2 then the final image  
will have:

* 2 rows of color 2
* 18 rows of color 1
* 16 rows of color 2

If you were to try and resize the resulting image using your handler  
the offset would not remain the same (i.e. it might increase to 3 or 4  
pixels or go down to 1), hence why you regenerate the background  
pattern each time.

The reason the offset is important is due to the field borders.  
Without the offset the field borders will cover the first two pixels  
of line 1 of your list field. So visually the line will appear to be  
16 pixels rather than 18 pixels. By using an offset all 18 pixels of  
line 1 are visible.

If you don't mind this visual disparity in your program or if you are  
not using borders with your field then Eric's solution will work fine.  
If anyone wants to look at the handler again I will provide the link  
again for reference:

<http://revolution.screenstepslive.com/lessons/822-Alternating-Line-Colors-in-a-List-Field 
 >

Regards,

-- 
Trevor DeVore
Blue Mango Learning Systems
www.bluemangolearning.com    -    www.screensteps.com



More information about the use-livecode mailing list