Solved

String scrolling

Posted on 2001-08-05
6
142 Views
Last Modified: 2010-05-02
I'm building an MP3-Player and a CD-Player, now I'm getting the MP3-filename (Songtitle) to scroll on a label.
The problem I would like to solve is: there is a flikkering of the text and the spaces take more time than the actual characters, does anybody know how to get a smooth scroll without these glitches?

This is how I do it:

Private Sub cmdScroll_Click()
lblScroll.Caption = "                        " & txtInput.Text
tmrScrollNow.Interval = 75

End Sub



Private Sub tmrScrollNow_Timer()
   Dim strInputText As String
   Dim i As Integer
   Dim strFirstletter As String
   Dim strTextMinusFirst
   Dim bytLengte As Byte
   Dim strToScroll As String
     
     
 On Error Resume Next
      strInputText = lblScroll.Caption
      bytLengte = Len(strInputText)
      strFirstletter = Left(strInputText, 1)
   strTextMinusFirst = Right(strInputText, (bytLengte -1))
      strToScroll = strTextMinusFirst & strFirstletter
      lblScroll.Caption = strToScroll
      strInputText = strToScroll
 
End Sub


0
Comment
Question by:HeN_da_MaN
6 Comments
 
LVL 22

Accepted Solution

by:
CJ_S earned 50 total points
ID: 6353018
Best way to get that done is by using a frame. The clipcontrols property of that frame should be set to true. Now in that frame you put a label. You put the text in that label, and then  you decrement or increment the left property of that label. You can use a timer for that.

it would be something like:

Private Sub Timer1_Timer()
   Label1.Left = Label1.Left - 1
   If((Label1.Left + Label1.Width)<0) Then Label1.Left = Frame1.Width
End Sub

Regards,
CJ
0
 
LVL 3

Expert Comment

by:Bahnass
ID: 6353043

How about putting a label on a picture box
then moving it
like that


Hi HeN_da_MaN

Private Sub Command1_Click()
lblScroll.Caption = "                        " & txtInput.Text
tmrScrollNow.Interval = 5

End Sub

Private Sub tmrScrollNow_Timer()
  Dim strInputText As String
  Dim i As Integer
  Dim strFirstletter As String
  Dim strTextMinusFirst
  Dim bytLengte As Byte
  Dim strToScroll As String
     
     
On Error Resume Next
 lblScroll.Left = lblScroll.Left - 2
 If lblScroll.Left = -lblScroll.Width Then lblScroll.Left = 0
 
End Sub
yours

0
 
LVL 3

Expert Comment

by:Bahnass
ID: 6353044
Sorry C_J
I did not updated
U R too fast
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 3

Expert Comment

by:andysalih
ID: 6353569
what about doing it like this

Public Str As String
Private Sub Form_Load()
Caption = ""

Timer1.Interval = 200
Str = "Hello, World! "
End Sub

Private Sub Timer1_Timer()
Static x As Integer
If x < Len(Str) Then
x = x + 1
Caption = Caption & Mid(Str, x, 1)
Else    
x = 0
Caption = ""  
End If
End Sub


cheers

hope this helps
andy
0
 
LVL 4

Expert Comment

by:wileecoy
ID: 6353756
HeN_da_MaN

I use your code and it works just fine for me.  No blinking and spaces take the same amount of time as all other numbers & letters.

0
 

Author Comment

by:HeN_da_MaN
ID: 6358227
Thank you,

Hen
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now