Solved

Scrolling text

Posted on 1999-01-14
17
235 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
  • 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

839 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