Alternating stripes in fields
Sarah Reichelt
sarahr at genesearch.com.au
Tue Mar 8 17:20:16 EST 2005
Dear list,
There have been seveal attempts to emulate iTunes-like alternating
stripes as backgrounds for scrolling fields in Revolution. I started
with a stack posted by Malte Brill (Thanks Malte) and made some
changes. Here is my technique and the required scripts:
-------------------------------
Make a graphic with alternating stripes the height of the field's
textHeight.
It must be at least twice as high as the scrolling field.
Import it into the stack and group it into a single item group.
Resize the group to the size of the field and position over the field,
then lock it's location.
Send group to back & position accurately, making it a few pixels
smaller if required. Move up & down one or two pixels to line up with
text after the initialization script has run once.
In these scripts, the striped graphic group is called "StripesGroup"
and the scrolling field is called "Scroller"
-- put this in preOpenCard handler
-- initialize scrolling striped background
--
set the vscroll of fld "Scroller" to 0
set the vscroll of grp "StripesGroup" to the effective textHeight of
fld "Scroller" * 2
-- put these in the field script
--
on scrollBarDrag
setStripeScroll
end scrollBarDrag
-- called by scrollBarDrag in scrolling field
--
on setStripeScroll
put the vScroll of me into tScroll
put the effective textHeight of me into tHeight
put tHeight * 10 into tSkip
-- change this to 6 or so if there are less than 7 lines visible
put (tScroll div tSkip) + 1 into tScrollLoop
put tScrollLoop * tSkip into tCorrect
put tScroll + tSkip - tCorrect + (tHeight * 2) into newScroll
if newScroll > tSkip then subtract tSkip from newScroll
set the vScroll of grp "StripesGroup" to newScroll
end setStripeScroll
More information about the use-livecode
mailing list