Scrolling text effect

Post

Posted
Rating:
#1 (In Topic #1939)
Avatar
Enthusiast
Yogi is in the usergroup ‘Enthusiast’

with ScrollView

Hi Folks,

I would like to share a topic: vertical ticker text

and at the same time ask what could be improved.

In Gambas at the beginning, there is ‘About’, which features vertical ticker text with images
using a gridview. I looked at the source code and couldn't quite figure it out.

So I programmed a simpler version based on a ‘Scrollview’ and a ‘Textlabel’ object used
in a modul.

Here is the result and if you know a simple and better way to mix Text and Images,
let me know. Magic word "simple" 🙂

Code (gambas)

  1. Public Sub btnAbout_Click()
  2. s = File.Load("./loremIpsum.txt")
  3. LFAbout.ShowAbout("Linux/Ubuntu/Gambas", s, 500, 300)

The sub takes the window title
a string to be shown
and optional arguments width and heigth of the window

It creates a new window with a scrollview and a textlabel object and a "OK" button.
Usage if the windows is shown (it is modal)

Mouse over the Scrolling Text:
Left Mouse Down … Scroll faster forward
Right Mouse Down … Scroll faster backward
ESC key or OK Button => quit

No special "bells and whistles", formatting the text you can use the HTML subset for a textlabel.

Image

Bildschirmfoto vom 2025-12-05 06-10-51.png

Bildschirmfoto vom 2025-12-05 06-10-51.png

Image

Bildschirmfoto vom 2025-12-05 06-11-04.png

Bildschirmfoto vom 2025-12-05 06-11-04.png
Attachment

LFScrollAbout-0.0.1.tar.gz


Regards,
Yogi
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘unknown’
cogier is in the usergroup ‘GambOS Contributor’

Yogi said

Magic word "simple" 🙂

Ok, this version does not scroll past the top and therefore is not endless, but is very simple :thumbs: . You will need to add your "loremIpsum.txt" file to the program.

Code (gambas)

  1. Private TextLabelDisplay As TextLabel
  2. Private aSpring As Spring
  3.  
  4. Public Sub Form_Open()
  5.  
  6.   With Me
  7.     .Padding = 5
  8.     .Arrangement = Arrange.Vertical
  9.     .H = 700
  10.     .W = 415
  11.     .Y = 50
  12.  
  13.   aSpring = New Spring(Me)
  14.  
  15.   TextLabelDisplay = New TextLabel(Me) As "TextLabelDisplay"
  16.   TextLabelDisplay.Text = File.Load(Application.Path &/ "loremIpsum.txt")
  17.  
  18.   Timer1 = New Timer As "Timer1"
  19.   Timer1.Delay = 25
  20.   Timer1.Start
  21.  
  22.  
  23. Public Sub Timer1_Timer()
  24.  
  25.   Inc TextLabelDisplay.H
  26.  


Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Enthusiast
Yogi is in the usergroup ‘Enthusiast’

cogier said


Ok, this version does not scroll past the top and therefore is not endless, but is very simple :thumbs: . You will need to add your "loremIpsum.txt" file to the program.

Code (gambas)

  1. Private TextLabelDisplay As TextLabel
  2. Private aSpring As Spring
  3.  
  4. Public Sub Form_Open()
  5.  
  6.   With Me
  7.     .Padding = 5
  8.     .Arrangement = Arrange.Vertical
  9.     .H = 700
  10.     .W = 415
  11.     .Y = 50
  12.  
  13.   aSpring = New Spring(Me)
  14.  
  15.   TextLabelDisplay = New TextLabel(Me) As "TextLabelDisplay"
  16.   TextLabelDisplay.Text = File.Load(Application.Path &/ "loremIpsum.txt")
  17.  
  18.   Timer1 = New Timer As "Timer1"
  19.   Timer1.Delay = 25
  20.   Timer1.Start
  21.  
  22.  
  23. Public Sub Timer1_Timer()
  24.  
  25.   Inc TextLabelDisplay.H
  26.  




Hi cogier ,

Wow, a really short one.
Thanks for sharing 👍


Regards,
Yogi
Online now: No Back to the top
1 guest and 0 members have just viewed this.