Solved

Scrolling text

Posted on 1999-01-14
17
200 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
you mean the wuestion is mine?

0
 
LVL 7

Expert Comment

by:Inteqam
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:abidr
Comment Utility
I can say he did not due to my ltd knowledge
0
 

Author Comment

by:abidr
Comment Utility
it is increased by another 20

0
 
LVL 7

Accepted Solution

by:
Inteqam earned 40 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
100x100 pix - 200x200 max
0
 

Author Comment

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

Expert Comment

by:Inteqam
Comment Utility
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
Comment Utility
oh no problem
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 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

13 Experts available now in Live!

Get 1:1 Help Now