Have a text that scrolls automatically in a text field

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Have a text that scrolls automatically in a text field

Post by Mag » Mon Mar 18, 2013 5:17 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

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

Post by Simon » Mon Mar 18, 2013 9:02 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

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

Post by Mag » Mon Mar 18, 2013 9:10 pm

:oops: mhh... a think like send "tmessage" in x seconds? And to make it looping what is the best practice?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

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

Post by Simon » Mon Mar 18, 2013 9:19 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

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

Post by Mag » Tue Mar 19, 2013 10:51 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

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

Post by Simon » Tue Mar 19, 2013 11:53 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Klaus
Posts: 14206
Joined: Sat Apr 08, 2006 8:41 am
Contact:

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

Post by Klaus » Wed Mar 20, 2013 11:16 am

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

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

Post by Simon » Wed Mar 20, 2013 8:32 pm

Klaus,
Capitalize the third "S"
That should clear it up :D :D :D

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

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

Post by jacque » Thu Mar 21, 2013 12:14 am

And shouldn't that field name be "creditTaxFiled"?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply