Link to home
Start Free TrialLog in
Avatar of abidr
abidr

asked on

Scrolling text

How to make a programe to make a sentence to scroll accross the screen i a repeated fashion
thanks
Avatar of rayford
rayford

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$
Avatar of abidr

ASKER

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
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

Avatar of abidr

ASKER

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.
you mean the wuestion is mine?

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

Avatar of abidr

ASKER

hi : Inteqam, yes you helped a lot, how can the question be yours tell me how & i will increase the points you want
thanks
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.

Avatar of abidr

ASKER

I can say he did not due to my ltd knowledge
Avatar of abidr

ASKER

it is increased by another 20

ASKER CERTIFIED SOLUTION
Avatar of Inteqam
Inteqam

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of abidr

ASKER

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
what is the width and hight of the image ,

And BTW :

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

Avatar of abidr

ASKER

100x100 pix - 200x200 max
Avatar of abidr

ASKER

hello, where are u ... i hope u R OK
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

Avatar of abidr

ASKER

oh no problem