iTunes-type alternate colored lines in scrolling list field

Greg Saylor gsaylor at net-virtual.com
Wed Mar 5 04:51:01 EST 2003


Hello,

I was very interested in this, because it's exactly what I want to do...
 But, I am wondering how can you do this so that it is even more like
iTunes?...  What I mean is, I need to be able to sort the various columns
with the little vertical arrows depending on which field was sorted and
how it was sorted...  The fields I have are going to be either numeric,
alphanumeric, and a date in the format of "03-02-2003"...

Thanks so much!

- Greg

>Hi Valetia,
>
>There are two ways to go, depending on what you want.
>1) if you're okay with 'line-per-line' scrolling of
>your field, you can simply:
>- create a pattern in your favourite painting app
>- import it as an image
>- use the 'Colors' palette to set the
>backgroundPattern of the field to your imported
>pattern
>- set the script of the field to :
>  on scrollbarDrag
>    put the scroll of me into tScroll
>    put the effective textHeight of me into
>tLineHeight
>    if (tScroll MOD tLineHeight) is not 0 then
>      set the scroll of me to \
>          ((tScroll DIV tLineHeight) * tLineHeight)
>    end if
>  end scrollbarDrag
>
>2) if you want pixel-per-pixel' scrolling, things get
>a bit more complicated, but it is possible ; here's
>the way I did it :
>- create a pattern in your favourite painting app
>- import it as an image
>- create a rectangle the size of the field > 'Foo'
>- set its lineSize to 0
>- use the 'Colors' palette to set the
>backgroundPattern of the rectangle to your imported
>pattern
>- group the rectangle > 'Bar'
>- set the margins of group "Bar" to 0
>- set the lockLocation of group "Bar" to true
>- move the group behind the field
>- set the field's opaque to false
>Now a few more steps are needed to make it scroll
>well:
>- set the script of the field to :
>  on scrollbarDrag
>    set the scroll of group "Bar" to the scroll of me
>  end scrollbarDrag
>  on InitBkgnd
>    put the rect of graphic "Foo" into tBgRect
>    put the formattedHeight of me into tHeight
>    add (tHeight - item 4 of tRect - item 2 of tRect)
>\
>        to item 4 of tRect
>  end InitBkgnd
>- and use the message box to :
>  set the scroll of grp "Bar" to 1
>  set the scroll of fld "List" to 1
>  send "InitBkgnd" to fld "List"
>
>You may have to fiddle some positions a bit with
>respect to the field margins, and you'll have to make
>sure the list field has a fixed line height.
>
>Hope this helped,
>
>Jan Schenkel.






More information about the use-livecode mailing list