Alternating stripes in fields

Lynch, Jonathan BNZ2 at CDC.GOV
Tue Mar 8 17:33:59 EST 2005


Could this same effect not be accomplished with a scrolling group
containing locked text fields stacked on top of each other?

The background color of the locked text fields could be anything you
want.

With that, there would be no need for any scripting to keep the
background synched up with the line - when you scroll the group, it
would all be automatic.

-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Sarah
Reichelt
Sent: Tuesday, March 08, 2005 5:20 PM
To: use-revolution at lists.runrev.com
Subject: Alternating stripes in fields

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

_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list