Vscroll Property of a field that is scrolled to the end

Jan Schenkel janschenkel at yahoo.com
Sun Jul 6 16:09:16 EDT 2008


--- Sivakatirswami <katir at hindu.org> wrote:
> How do you get the vscroll of a field that would be
> scrolled all the way 
> to the end, without actually scrolling it to the
> end?
> 
> What I want to do is the "rolling credits" thing.
> 
> This works
> 
> CASE "About"
>     put 1 into tAboutScroll
>     REPEAT until the vscroll of fld "About" = 2714
> # the 2714 here is hard coded value...
> # I want to get it as a property regardless of what
> the field contains 
> or it's size, font etc.
>       set the vscroll of fld "About" to tAboutScroll
>       put tAboutScroll +1 into tAboutScroll
>       IF the mouseclick THEN exit repeat
>       wait 1 ticks
>     END repeat
>     break
> 
> But you have to customize that for every field...
> the 2714 is hard 
> coded. I'm trying to get generic script that I can
> toss around from one 
> stack to another and they still work...
> 
> 
> put the formattedheight of fld "song"-the height of
> fld "song"- the 
> vscroll of fld "song"
> 
> always returns 6... so one can calculate the ending
> vscroll value from 
> this,  if I have the field scrolled to the very end.
>   Is this a  
> "solid" algorithm:
> 
> on scrollsong
>      put 1 into tSongScroll
>    put (the formattedheight of fld "song"-the height
> of fld "song"- 5) 
> into tEnd
>     REPEAT until the vscroll of fld "Song" = tEnd
> 
>       set the vscroll of fld "song" to tSongScroll
>       put tSongScroll +1 into tSongScroll
>       IF the mouseclick THEN exit repeat
>       wait 5 milliseconds
>     END repeat
>  end scrollsong
> 
> it feels like a bit of a hack....when I could be use
> some actual property.
> 
> 
> skts
> 

Hi Swami,

Technically, you also have to take the margins into
account to get an actual value ; so how about doing it
differently?
Check if scrolling the field once more has actually
scrolled it? I mean, if you set the vScroll of a field
to something larger than its maximum vScroll value, it
will automatically 'snap' it to this maximum value.
So you could repeat increasing the vScroll until it
doesn't want to increase anymore, which you can check
by comparing the vScroll after setting it to the value
that you set it to.

Just an idea,

Jan Schenkel.

Quartam Reports & PDF Library for Revolution
<http://www.quartam.com>

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)


      



More information about the use-livecode mailing list