iTunes-type alternate colored lines in scrolling list field

Malte Brill malte.brill at t-online.de
Sat Mar 15 06:39:01 EST 2003


Hi,

Sorry for bringing this up again.
I have been thinking about this for a while and found a solution that works
for me. Hope I don´t bother you with this, so I post a small report on what
I did here.
If you are interested, I can send you the stack off-list.

I created an image in Photoshop Elements. Each bar 14 Pix heigh, 20 bars.
Created a fld in rev. Imported the image, grouped it, checked lock location
and size for the group, moved group behind field, set the opaque of fld to
false. Set the rect of the group to the rect of the field. Set the effective
Textheight to 14 pix.

Put the following into the card Script:

-----------------------------------------------------------------
global loop,correct,twoLines,skipline

on opencard
  put 1 into loop
  put the effective textHeight of fld "theField"*10 into skipline
  put the effective textHeight of fld "theField"*2 into twoLines
  put skipline into correct
  set the vscroll of fld "theField" to 0
  set the vscroll of grp "theImage" to twolines
end opencard
------------------------------------------------------------------

Put the following into the script of the field:

------------------------------------------------------------------
global loop,correct,skipline,twolines

on scrollbardrag
  if correct-the vscroll of me<=0 then
    put loop+1 into loop
    put loop*skipline into correct
  end if
  if the vscroll of me+skipline-correct<0 then
    put loop-1 into loop
    put loop*skipline into correct
  end if
  put the vscroll of me+skipline-correct+twoLines into groupScroll
  set the vscroll of grp "theImage" to groupScroll
end scrollbardrag
-------------------------------------------------------------------

Typed send opencard to this card in the messagebox to initialize.

This works pretty well in 1.1.1 even though it needs a bit extra scripting,
if you want to set the vscroll of the field via script.

It looks a bit cheesy on PreBeta 4.
(Seems like in PB4 <= is only treated as < and the = part gets lost.)

The fld should not heigher as half the height of the image-2*the effective
textheight (as 2 lines are added to get rid of the cheesy vscroll=0
position)

I guess all of you allready have a satisfying solution, but I wanted to
share this with you.

Regards,

Malte

 




More information about the use-livecode mailing list