scrolling form caption

J

JohnE

Hello. I have the following code that I am going to use so the form caption
will scroll like a marquee. It works with several exceptions. The form
caption is named in the form's properties (call it Test Form). I realize I
am renaming it in the form load, which brings me to a question.

I am looking to keep the caption as is (Test Form) and have the training
session scroll next to it in the form's caption area. This is the part that
is losing me. How can I get it to do that? Also, I need to make this into a
function so it can be used on all forms, not just the one. Which I also need
help on.

Private Sub Form_Load()

Me.Caption = "......Training Session......"

End Sub

Private Sub Form_Timer()
Me.Caption = Mid(Me.Caption, 2, (Len(Me.Caption) - 1)) &
Left(Me.Caption, 1)

End Sub

This code scolls the caption like a marquee but it all scrolls.

Thanks... John
 
M

Marshall Barton

JohnE said:
Hello. I have the following code that I am going to use so the form caption
will scroll like a marquee. It works with several exceptions. The form
caption is named in the form's properties (call it Test Form). I realize I
am renaming it in the form load, which brings me to a question.

I am looking to keep the caption as is (Test Form) and have the training
session scroll next to it in the form's caption area. This is the part that
is losing me. How can I get it to do that? Also, I need to make this into a
function so it can be used on all forms, not just the one.


Here's the code in a form that I used to test this:

Public MyCaption As String
Public Pos As Integer
Public ScrollText As String

Private Sub Form_Load()
MyCaption = Me.Caption
ScrollText = "... scrolling text ..."
Me.TimerInterval = 200
End Sub

Private Sub Form_Timer()
ScrollCaption Me
End Sub

And gere's a standard module Sub procedure that can be
called from any form:

Public Sub ScrollCaption(frm As Form)
With frm
.Caption = .MyCaption & " " _
& Mid(.ScrollText, .Pos + 1) & Left(.ScrollText, .Pos)
.Pos = (.Pos + 1) Mod Len(.ScrollText)
End With
End Sub

BUT, BUT, timer events can cause all kinds of issues. One
huge issue is that they can wreak havoc on the VBE, so you
***MUST*** close all forms that have a running timer (or at
least disable all timers) before editing any code in any
form/report/module.

I strongly reccommend that you do not add this cutsie
bell/whistle to any program.
 
J

JohnE

Mr Barton, you are probably right on not using it but the boss saw it and
thought it would be a good way for new people to distinguish between the
front end going to the real back end db or the front end in training mode
going to a training back end db. Something that was very obvious. I've been
trying to come up a different way to distinguish the front end as real or
training. Have you had to do anything like that? If so, how did you make
the distinguishment between the two ways?

Eitherway, thanks or the come back.

.... John
 
M

Marshall Barton

JohnE said:
Mr Barton, you are probably right on not using it but the boss saw it and
thought it would be a good way for new people to distinguish between the
front end going to the real back end db or the front end in training mode
going to a training back end db. Something that was very obvious. I've been
trying to come up a different way to distinguish the front end as real or
training. Have you had to do anything like that? If so, how did you make
the distinguishment between the two ways?

Eitherway, thanks or the come back.

... John


I used to append the backend identifyer to the main control
form's Caption. Before too long, I needed to display more
info about the running configuration. So, now I use a bunch
of label controls with front end and back end identifiers,
version nos, etc. with a bright color for nonstandard
configuration elements.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top