Vscroll Property of a field that is scrolled to the end

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Vscroll Property of a field that is scrolled to the end

Sivakatirswami
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

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Vscroll Property of a field that is scrolled to the end

Jan Schenkel
--- Sivakatirswami <[hidden email]> 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)


     
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Vscroll Property of a field that is scrolled to the end

xtalkprogrammer
In reply to this post by Sivakatirswami
Hi Sivakatirswami,

I have posted this a few times already, I guess it won't hurt if I  
post it again.

The maximum scroll equals:


Code:
the formattedHeight of fld x - the height of fld x - the margins of  
fld x - the textHeight of fld x


provided that the margins are an integer and the fixedLineHeight of  
the field is true. If the margins are no integer, you probably need  
to use item 4 of the margins. If the fixedLineHeight is not true, you  
need to find a way to figure out the height of the last line of your  
field. Also, the dontWrap of your field has to be set to true.

This is a nice way to do it:

Code:
getProp maxScroll
   if word 1 of the name of the target is "field" then
   return (the formattedHeight of the target - the height of the  
target - the margins of the target - the textHeight of the target)
   else return empty
end maxScroll

(untested, but should work)

Now, if you have this script at stack level or in a library, you can  
call this property using:


Code:
put the maxScroll of fld x
set the vScroll of fld x to the maxScroll of fld x

The first line should return an integer, the second should set the  
scroll of a field to the largest possible value.

--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Get your store on-line within minutes with Salery Web Store software.  
Download at http://www.salery.biz

Op 6-jul-2008, om 21:58 heeft Sivakatirswami het volgende geschreven:

> 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
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: Vscroll Property of a field that is scrolled to the end

ScottR
In reply to this post by Sivakatirswami
Recently, Sivakatirswami 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?

The formattedHeight of the field - the height of the field - the margins of
the field comes very close.  But for an exact number, I usually lock the
screen, set the vscroll to a huge amount (100000000), get the scroll of the
fld, reset the vscroll to its original value, and then unlock the screen.  A
bit goofy but it's fast and it works.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Vscroll Property of a field that is scrolled to the end

masmit
In reply to this post by Sivakatirswami
This doesn't look to 'hacky' to me - maybe you could use both exit  
conditions in the 'until' and I'm not sure you need to to do the  
calculation - using just 'the formattedheight' seems to work fine:

repeat until (the vscroll of fld "Song" = the formattedHeight of fld  
"Song") or the mouseclick

though this doesn't improve the functionality at all -  the  
fomattedHeight is a reliable property, so it seems like a good  
approach...


Best,

Mark

On 6 Jul 2008, at 20:58, Sivakatirswami wrote:

>
> 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
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Vscroll Property of a field that is scrolled to the end

masmit
Please ignore - I hadn't read the much better replies from Jan, Mark  
and Scott!

best,

Mark

On 7 Jul 2008, at 00:28, Mark Smith wrote:

> This doesn't look to 'hacky' to me - maybe you could use both exit  
> conditions in the 'until' and I'm not sure you need to to do the  
> calculation - using just 'the formattedheight' seems to work fine:
>
> repeat until (the vscroll of fld "Song" = the formattedHeight of  
> fld "Song") or the mouseclick
>
> though this doesn't improve the functionality at all -  the  
> fomattedHeight is a reliable property, so it seems like a good  
> approach...
>
>
> Best,
>
> Mark
>
> On 6 Jul 2008, at 20:58, Sivakatirswami wrote:
>>
>> 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
>>
>> _______________________________________________
>> use-revolution mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Vscroll Property of a field that is scrolled to the end

pmbrig
In reply to this post by Sivakatirswami
On Jul 7, 2008, at 10:49 AM, Scott Rossi <[hidden email]> wrote:

> Recently, Sivakatirswami 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?
>
> The formattedHeight of the field - the height of the field - the  
> margins of
> the field comes very close.  But for an exact number, I usually  
> lock the
> screen, set the vscroll to a huge amount (100000000), get the  
> scroll of the
> fld, reset the vscroll to its original value, and then unlock the  
> screen.  A
> bit goofy but it's fast and it works.
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, Multimedia & Design

I discovered another way a while ago:

function maxScroll fldName
   put the scroll of fld fldName into iScr
   lock screen
   select after text of fld fldName
   put the scroll of fld fldName into maxScr
   select empty
   set the scroll of fld fldName to iScr
   unlock screen
   return maxScr
end mouseUp

You'll have to adjust the field reference if the field is not on the  
current card.

Peter M. Brigham
[hidden email]
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Vscroll Property of a field that is scrolled to the end

Sivakatirswami
In reply to this post by ScottR
Scott Rossi wrote:

> Recently, Sivakatirswami 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?
>>    
>
> The formattedHeight of the field - the height of the field - the margins of
> the field comes very close.  But for an exact number, I usually lock the
> screen, set the vscroll to a huge amount (100000000), get the scroll of the
> fld, reset the vscroll to its original value, and then unlock the screen.  A
> bit goofy but it's fast and it works.
>  
Ha! I love it... another Widget from the House of WHEW (WHatEverWorks).

Thanks :-)

and Mark, your response was also very instructive and useful... first
time I'm understanding it clearly.

Thanks



> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, Multimedia & Design
>
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>  

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution