Solved

Scrolling text

Posted on 1999-01-14
17
259 Views
Last Modified: 2010-05-03
How to make a programe to make a sentence to scroll accross the screen i a repeated fashion
thanks
0
Comment
Question by:abidr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 7
17 Comments
 
LVL 1

Expert Comment

by:rayford
ID: 1456358
You use the timer control to cause a repeated event to be triggered.  In the event you simply take the text in the text box and make it scroll.  

What delay you set the timer to will determine the scroll speed.  To remove video speed from the display update factor (varies from PC to PC) you should do a text1.refresh after updating it to ensure it is redrawn before resetting the delay.

The timer event will need to reset its delay everytime to be triggered again repeatedly this is where the loop is generated.
The text itself could easily be circled/scrolled by a command like this:

ABC$= Right(ABC$,len(ABC$)-1) & LEFT(ABC$,1)
Text1=ABC$
0
 

Author Comment

by:abidr
ID: 1456359
thanks
Itried to think how this is done, but due to my ltd knowledge I failed, can u give a code to try with explaining the timer and how i can link the text code  with it
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1456360
put three text boxed in a form , try to let one of them virtical, and put two timers , and two command buttons ,
and a label , then paste the followin in the form code:

Private strt As String
Private eno As Boolean
Private Sub Command1_Click()
If Len(Text1.Text) > 0 Then
    split (Text1.Text)

    While Label1.Height + 50 <= Text2.Height
        Text2.Text = Text2.Text + vbCrLf
        Label1.Caption = Text2.Text
    Wend
    Timer1.Enabled = True
    Label1.Caption = ""
End If
End Sub

Private Sub Command2_Click()
If Len(Text1.Text) > 0 Then Text3.Text = Text1.Text
    While Label1.Width + 50 <= Text3.Width
        Text3.Text = Text3.Text + " "
        Label1.Caption = Text3.Text
    Wend
    Timer2.Enabled = True
    Label1.Caption = ""
End Sub

Private Sub Form_Load()
    Timer1.Enabled = False
    Timer2.Enabled = False
    Label1.AutoSize = True
    Label1.Visible = False
    Label1.Caption = ""
    Label1.Width = 70
    Label1.Height = 30
    Text2.Locked = True
    Text3.Locked = True
    Command1.Caption = "Scroll v"
    Command2.Caption = "Scroll h"
    Text1.Text = ""
    Text2.Text = ""
    Text3 = ""
   
    Timer1.Interval = 500  ' you can change here as to change the speed of scrolling
    Timer2.Interval = 500
End Sub

Private Sub Timer1_Timer()
    Dim npos As Integer
   
    strt = Text2.Text
    npos = InStr(1, strt, vbCrLf, vbTextCompare)
    strt = Right(strt, Len(strt) - npos - 1) + Left(strt, npos + 1)
    Text2.Text = strt
End Sub

Private Sub split(strt As String)
    Dim i As Integer
    Dim ch As String
    Text2 = Mid(strt, 1, 1)
    For i = 2 To Len(strt)
        ch = Mid(strt, i, 1)
        Text2.Text = Text2.Text + vbCrLf + ch
    Next
   
End Sub

Private Sub Timer2_Timer()
strt = Text3.Text
strt = Right(strt, Len(strt) - 1) + Left(strt, 1)
Text3.Text = strt
End Sub

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:abidr
ID: 1456361
thanks a lot, tell me Is there a chance to scroll an icon image before the text, if it is possible please let me know to increase your points.
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1456362
you mean the wuestion is mine?

0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1456363
if yes , then let me answer the question and increase the points , and i will try to do what you asked.

0
 

Author Comment

by:abidr
ID: 1456364
hi : Inteqam, yes you helped a lot, how can the question be yours tell me how & i will increase the points you want
thanks
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1456365
well, did dayford answer satisfy you , if yes , post another question titles for inteqam , with points , i'll answer it , if no   , reject the answer , and increase the points , and i'll try to find you a solution for the image.

0
 

Author Comment

by:abidr
ID: 1456366
I can say he did not due to my ltd knowledge
0
 

Author Comment

by:abidr
ID: 1456367
it is increased by another 20

0
 
LVL 7

Accepted Solution

by:
Inteqam earned 40 total points
ID: 1456368
Now increase the points and answer the question , make it an A please :0)
, and tell me what you want exactly from the picture ,
put three text boxed in a form , try to let one of them virtical, and put two timers , and two command buttons ,
and a label , then paste the followin in the form code:

Private strt As String
Private eno As Boolean
Private Sub Command1_Click()
If Len(Text1.Text) > 0 Then
    split (Text1.Text)

    While Label1.Height + 50 <= Text2.Height
        Text2.Text = Text2.Text + vbCrLf
        Label1.Caption = Text2.Text
    Wend
    Timer1.Enabled = True
    Label1.Caption = "" 
End If
End Sub

Private Sub Command2_Click()
If Len(Text1.Text) > 0 Then Text3.Text = Text1.Text
    While Label1.Width + 50 <= Text3.Width
        Text3.Text = Text3.Text + " "
        Label1.Caption = Text3.Text
    Wend
    Timer2.Enabled = True
    Label1.Caption = "" 
End Sub

Private Sub Form_Load()
    Timer1.Enabled = False
    Timer2.Enabled = False
    Label1.AutoSize = True
    Label1.Visible = False
    Label1.Caption = "" 
    Label1.Width = 70
    Label1.Height = 30
    Text2.Locked = True
    Text3.Locked = True
    Command1.Caption = "Scroll v"
    Command2.Caption = "Scroll h"
    Text1.Text = "" 
    Text2.Text = "" 
    Text3 = "" 
    
    Timer1.Interval = 500  ' you can change here as to change the speed of scrolling
    Timer2.Interval = 500
End Sub

Private Sub Timer1_Timer()
    Dim npos As Integer
    
    strt = Text2.Text
    npos = InStr(1, strt, vbCrLf, vbTextCompare)
    strt = Right(strt, Len(strt) - npos - 1) + Left(strt, npos + 1)
    Text2.Text = strt
End Sub

Private Sub split(strt As String)
    Dim i As Integer
    Dim ch As String
    Text2 = Mid(strt, 1, 1)
    For i = 2 To Len(strt)
        ch = Mid(strt, i, 1)
        Text2.Text = Text2.Text + vbCrLf + ch
    Next
    
End Sub

Private Sub Timer2_Timer()
strt = Text3.Text
strt = Right(strt, Len(strt) - 1) + Left(strt, 1)
Text3.Text = strt
End Sub
0
 

Author Comment

by:abidr
ID: 1456369
thanks, i have increased the points from 20 to 40, if you want more tell me. Now for the image, i need an image to scrol in the same horizental text box scroll or before it or after it to display an image to go with the message, the scroll rate should be the same as the text.

thanks
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1456370
what is the width and hight of the image ,

And BTW :

for the points , I Am respecting you generous .
:0)

0
 

Author Comment

by:abidr
ID: 1456371
100x100 pix - 200x200 max
0
 

Author Comment

by:abidr
ID: 1456372
hello, where are u ... i hope u R OK
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1456373
sorry ,
but it seems that there is a problem here ,

i didn't recieve any emails except the one who tells that i have a Good answer ,

sorry again , because i tried the image and i failed.

sorry again

Yours :
  Inteqam

0
 

Author Comment

by:abidr
ID: 1456374
oh no problem
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

729 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