Rebol Talk Forum  |  REBOL Discussions  |  REBOL View  |  Topic: Horizontal scrolling text
Pages: [1] Print
Author Topic: Horizontal scrolling text  (Read 697 times)
jvvisser
Newbie
*
Offline Offline

Posts: 5


View Profile
Horizontal scrolling text
« on: January 15, 2008, 09:27:19 AM »

Hi!
I would like to write a small stand alone script that reads text from a file and scrolls it in a bar like news tickers. How can I get the text to scroll fluidly from right to left. Are there some smart tricks to get the text scrolling?
Thank you!!
Logged
Gabriele
Full Member
***
Offline Offline

Posts: 182


View Profile WWW
Re: Horizontal scrolling text
« Reply #1 on: January 15, 2008, 05:22:56 PM »

Just to get you started:

Code:
view layout [
    size 300x60
    text 2000x24 "Some very looooooooooooooooooooooooooooooooooooooooooooooooong text to scroll and so on and so on and so on......................."
        rate 25 feel [
            engage: func [face action event] [
                if action = 'time [
                    face/offset: face/offset - 1x0
                    face/changes: 'offset
                    show face
                ]
            ]
        ]
]
Logged
jvvisser
Newbie
*
Offline Offline

Posts: 5


View Profile
Re: Horizontal scrolling text
« Reply #2 on: January 16, 2008, 08:01:06 PM »

Thanks a lot!!
It works fine, but the memory usage keeps growing slowly, from 10MB on. It seems to never stop, couple of kb each time...
It that something I should worry about?
Thanks again...
Logged
jvvisser
Newbie
*
Offline Offline

Posts: 5


View Profile
Re: Horizontal scrolling text
« Reply #3 on: January 16, 2008, 08:02:56 PM »

Ah well, it stops at 13 MB...
Logged
jvvisser
Newbie
*
Offline Offline

Posts: 5


View Profile
Re: Horizontal scrolling text
« Reply #4 on: January 17, 2008, 08:36:05 AM »

Is there an easy way to get it looping when all the text has scrolled?
Thanks!!!!
Logged
notchent
Newbie
*
Offline Offline

Posts: 40


View Profile WWW
Re: Horizontal scrolling text
« Reply #5 on: January 18, 2008, 01:35:53 PM »

Check if the offset is off screen far enough, then reset it to the starting point (if face/offset = -75x20 [face/offset: 75x20]):

view layout [
    size 75x60
    at 75x20 text 75x24 "Scrolling text"
        rate 25 feel [
            engage: func [face action event] [
                if action = 'time [
                    if face/offset = -75x20 [face/offset: 75x20]
                    face/offset: face/offset - 1x0
                    face/changes: 'offset
                    show face
                ]
            ]
        ]
]
Logged

Pages: [1] Print 
Rebol Talk Forum  |  REBOL Discussions  |  REBOL View  |  Topic: Horizontal scrolling text
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 08, 2008, 02:34:40 AM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2245 Posts in 589 Topics by 2259 Members
Latest Member: edibritrava

  Rebol Talk Forum | Powered by SMF 1.0.9.
© 2001-2005, Lewis Media. All Rights Reserved.

RT design by Defiant Pc