Page 1 of 1

Have a text that scrolls automatically in a text field

Posted: Mon Mar 18, 2013 5:17 pm
by Mag
Hi, do you know a way to have a text that scrolls automatically in a text field to use in an about box instead to force user to use the dragbar? It would be nice for users...

Re: Have a text that scrolls automatically in a text field

Posted: Mon Mar 18, 2013 9:02 pm
by Simon
Hi Mag,
Build a loop/send-in-time to increment the vScroll property of the field.
I'm pretty sure you know what I'm talking about, but if not I can add more.

Simon

Re: Have a text that scrolls automatically in a text field

Posted: Mon Mar 18, 2013 9:10 pm
by Mag
:oops: mhh... a think like send "tmessage" in x seconds? And to make it looping what is the best practice?

Re: Have a text that scrolls automatically in a text field

Posted: Mon Mar 18, 2013 9:19 pm
by Simon
Rats!
You said "best practice"...
I'm not that good :oops:

But things I've seen a lot

local tScrollValue
on scrollFld
add 1 to tScrollValue --work with this, 1 px maybe too little/too hard on the engine
set the vScroll of fld "about" to tScrollValue
send tScrollValue to me in 10 milliseconds --work with this as well
end scrollFld

I'm not sure if this is "best practice". And there is nothing in there that takes care of when you reach the bottom, but it won't explode :D

Simon

Re: Have a text that scrolls automatically in a text field

Posted: Tue Mar 19, 2013 10:51 pm
by Mag
Thank you so much for your help Simon, so I implemented this code in the Card script. Please feel free to suggest improvements... :D

Code: Select all

local tScrollValue, scrollOn

on preOpenCard
   set the vScroll of fld "creditsTextFiled" to "10" -- where the text begins, previous lines are empty
end preOpenCard

on openCard
   put "yes" into scrollOn
   scrollFld
end openCard

on closeCard
      put "off" into scrollOn
end closeCard

on scrollFld
   if scrollON = "yes" then
      
      if vScroll of field "creditsTextFiled" < tScrollValue then -- it's at end, reset it at the begin
         put "0" into tScrollValue
      end if
      
      -- if the mouseLoc is within the rect of field "creditsTextFiled" then
      if the mouse is down then
         
      else
         add 1 to tScrollValue 
         set the vScroll of fld "creditsTextFiled" to tScrollValue
      end if
      send "scrollFld" to me in 30 milliseconds
   end if
end scrollFld

Re: Have a text that scrolls automatically in a text field

Posted: Tue Mar 19, 2013 11:53 pm
by Simon
Looks good, actually you have done some interesting things.
If you get an error on closeCard I have a suggestion for that, but only if your solution isn't working for you.

put "0" into tScrollValue
I think should be
put "10" into tScrollValue
from your preOpenCard

Oh and I think you left out:
on preOpenCard
put "Simon is Super-Duper" & cr before fld "creditsTextFiled" 8)

Simon

Re: Have a text that scrolls automatically in a text field

Posted: Wed Mar 20, 2013 11:16 am
by Klaus
Hi Simon,

I get an error:
...
Compilation error: not a boolean value
Where: line 2
Hint: "Simon is super-Duper"
...
:D :D :D


Best

Klaus

Re: Have a text that scrolls automatically in a text field

Posted: Wed Mar 20, 2013 8:32 pm
by Simon
Klaus,
Capitalize the third "S"
That should clear it up :D :D :D

Simon

Re: Have a text that scrolls automatically in a text field

Posted: Thu Mar 21, 2013 12:14 am
by jacque
And shouldn't that field name be "creditTaxFiled"?