Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

String scrolling

Posted on 2001-08-05
6
Medium Priority
?
154 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 150 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

783 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