David Schmalzer
asked on
Scrolling Banner
Hello again experts,
Does anyone know of a way to put a scrolling banner or marquee, if you will, somewhere on a form? Would like to easily update the text from a button, or even get it's data from a field in the database. Ideas? Running Notes 5.0.11
Does anyone know of a way to put a scrolling banner or marquee, if you will, somewhere on a form? Would like to easily update the text from a button, or even get it's data from a field in the database. Ideas? Running Notes 5.0.11
ASKER
I am running client. and haven't a clue with Lotus script or javascript. I only know formula. Trying to learn.
ASKER
Could I insert a page into a form and use javascript in there?
OK, give me a moment and I'll try to put some code together.
I don't know if you can embed a page in a form or not. I've never had a need to try it. You **could** put a page in one frame of a frameset, and put your form in the other frame.
You can use notestimer, I did it long time back, Just keep adding a space to the computed field (which is the text) and it looks like it's scrolling...
-Partha
-Partha
ASKER
Not familiar with notestimer either. I've heard of it though.
OK. Start by creating a field on your form called Scroller. It should be computed when composed, for efficiency (so every F9 doesn't affect it). I suggest putting it in a layout area to control its size.
Next in the (Globals)(Declarations) section (this is in the section **ABOVE** where you define the form's Window Title, paste this:
' ==== BEGIN PASTE ====
Dim scrollerTimer As NotesTimer
Dim strMessage As String
Dim doc As NotesDocument
Dim intStart As Integer
Dim intLength As Integer
%INCLUDE "lsconst.lss"
' ===== END PASTE =====
Note that you don't need the lines with the equal signs.
Next, go down to the form's PostOpen event. Inbetween where it says "Sub Postopen(Source As Notesuidocument)" and where it says "End Sub", paste this:
' === BEGIN PASTE ====
Dim session As New NotesSession
Dim db As NotesDatabase
Dim pDoc As NotesDocument
Set scrollerTimer = New NotesTimer(1, "Scroller timer")
On Event Alarm From elapsedTimer Call scrollerTimerHandler
Set doc = Source.Document ' doc is global
intStart = 1 ' intStart is global
Set db = session.CurrentDatabase
Set pDoc = db.GetProfileDocument("Scr ollMessage ") ' The profile document. You'll need to define this is elsewhere
strMessage = pDoc.Message(0) ' strMessage is global
intLength = Len(strMessage) ' intLength is global
' ===== END PASTE =====
It will probably throw an error at you saying you have to define a subroutine. That's OK. Don't worry about it yet.
Put your cursor at the end of the End Sub line and press Enter. Then, paste in this:
' ==== BEGIN PASTE ====
Sub scrollerTimerHandler(Sourc e As NotesTimer)
doc.Scroller = Mid$(strMessage & " " & strMessage, intStart, intLength)
intStart = intStart + 1
If intStart > intLength + 1 Then intStart = 1
End Sub
' ===== END PASTE =====
This _should_ scroll your message by one character every second.
Note that the PostOpen code extracts the message you want to scroll from the Message field of the ScrollMessage profile document. You'll need to set up a button somewhere that sets that field. You can use an @Function like this:
@SetProfileField("ScrollMe ssage"; "Message"; "This is the text I would like to have scrolling in my field. It can be up to about 16 KB, but that's ridiculous.")
Obviously, if you're adept with the formula language, you could have your button prompt you for the text (using @Prompt([OKCancelEdit])) to put into the field in the profile document. Note that profile documents are cached at the user's workstation, so someone who keeps the database open won't necessarily see changes to the text immediately.
Does this help?
-- b.r.t.
Next in the (Globals)(Declarations) section (this is in the section **ABOVE** where you define the form's Window Title, paste this:
' ==== BEGIN PASTE ====
Dim scrollerTimer As NotesTimer
Dim strMessage As String
Dim doc As NotesDocument
Dim intStart As Integer
Dim intLength As Integer
%INCLUDE "lsconst.lss"
' ===== END PASTE =====
Note that you don't need the lines with the equal signs.
Next, go down to the form's PostOpen event. Inbetween where it says "Sub Postopen(Source As Notesuidocument)" and where it says "End Sub", paste this:
' === BEGIN PASTE ====
Dim session As New NotesSession
Dim db As NotesDatabase
Dim pDoc As NotesDocument
Set scrollerTimer = New NotesTimer(1, "Scroller timer")
On Event Alarm From elapsedTimer Call scrollerTimerHandler
Set doc = Source.Document ' doc is global
intStart = 1 ' intStart is global
Set db = session.CurrentDatabase
Set pDoc = db.GetProfileDocument("Scr
strMessage = pDoc.Message(0) ' strMessage is global
intLength = Len(strMessage) ' intLength is global
' ===== END PASTE =====
It will probably throw an error at you saying you have to define a subroutine. That's OK. Don't worry about it yet.
Put your cursor at the end of the End Sub line and press Enter. Then, paste in this:
' ==== BEGIN PASTE ====
Sub scrollerTimerHandler(Sourc
doc.Scroller = Mid$(strMessage & " " & strMessage, intStart, intLength)
intStart = intStart + 1
If intStart > intLength + 1 Then intStart = 1
End Sub
' ===== END PASTE =====
This _should_ scroll your message by one character every second.
Note that the PostOpen code extracts the message you want to scroll from the Message field of the ScrollMessage profile document. You'll need to set up a button somewhere that sets that field. You can use an @Function like this:
@SetProfileField("ScrollMe
Obviously, if you're adept with the formula language, you could have your button prompt you for the text (using @Prompt([OKCancelEdit])) to put into the field in the profile document. Note that profile documents are cached at the user's workstation, so someone who keeps the database open won't necessarily see changes to the text immediately.
Does this help?
-- b.r.t.
Sorry. The PostOpen code should have this line:
On Event Alarm From scrollerTimer Call scrollerTimerHandler
instead of from elapsedTimer.
On Event Alarm From scrollerTimer Call scrollerTimerHandler
instead of from elapsedTimer.
That scrolls pretty slowly. You can speed it up somewhat by changing the amount by which you increment intStart in the scrollerTimerHandler subroutine, though the scrolling is not smooth at all if you do so.
ASKER
Wow, thanks! I will try it tomorrow.
ASKER
I tried it and it works, but only when document is in edit mode. Can it scroll in Read mode?
I don't know of any way to make it do that, schmad01. Neither the uiDoc.Reload nor the uiDoc.Refresh commands work unless the document is in edit mode, so you can't force a refresh on it.
Would it be sufficient for your purposes to have this marquee in the message line at the bottom of the screen instead of up on the form? That would be doable regardless of the edit status of the document.
Otherwise, you might check out Partha's link.
-- b.r.t.
Would it be sufficient for your purposes to have this marquee in the message line at the bottom of the screen instead of up on the form? That would be doable regardless of the edit status of the document.
Otherwise, you might check out Partha's link.
-- b.r.t.
ASKER
Yes, let's try that.
Which "that" are you referring to? Scrolling in the message line?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
We use a java ticker within a client environment with a number of our clients (It sits on a customised welcome page), it's fairly simple to add text using @DbLookups. It was obtained from www.appletcollection.com, this particular applet is AScroll2.class by Goklan Dagli.
The applet sits on a form called Java Ticker, on the form is a field with the value 'computed for display' to:
dbfile:="GWCollab\\news.ns f";
viewname:="By Date";
docno:=1;
titlecolumnno:=3;
server:=@Subset(@DbName;1) ;
cnservername:=@Name([CN];s erver);
db:=server:thispath + "\\" +dbfile;
head:=@DbColumn("":"NoCach e";@Subset (@DbName;1 ):dbfile;v iewname;ti tlecolumnn o);
title:=@Subset(@Subset(hea d;docno);- 1);
id:=@DbLookup("":"NoCache" ;@Subset(@ DbName;1): dbfile;"(t icker)";ti tle;2);
link:="Notes://" + cnservername + "/" +dbfile +"/0/" + id +"?opendocument" ;
title
An example of the text parameter on the applet is:
dbfile:="GWCollab\\news.ns f";
viewname:="By Date";
docno:=1;
titlecolumnno:=3;
db:=server:thispath + "\\" +dbfile;
head:=@DbColumn("":"NoCach e";@Subset (@DbName;1 ):dbfile;v iewname;ti tlecolumnn o);
texttoshow:=@Subset(@Subse t(head;doc no);-1);
texttoshow
The link parameter for the above text is:
dbfile:="GWCollab\\news.ns f";
viewname:="By Date";
docno:=1;
titlecolumnno:=3;
server:=@Subset(@DbName;1) ;
cnservername:=@Name([CN];s erver);
db:=server:thispath + "\\" +dbfile;
head:=@DbColumn("":"NoCach e";@Subset (@DbName;1 ):dbfile;v iewname;ti tlecolumnn o);
title:=@Subset(@Subset(hea d;docno);- 1);
id:=@DbLookup("":"NoCache" ;@Subset(@ DbName;1): dbfile;"(t icker)";ti tle;2);
link:="Notes://" + cnservername + "/" +dbfile +"/0/" + id +"?opendocument" ;
link
Note: If this is to work in a mixed Notes 5 & Notes 6 environment, you will have to add a different form for Notes 6 as this type of Java applet will not work correctly in R6
I have an example of this which is fairly easy to follow, but I'm unsure as to how I can display it on this site.
The applet sits on a form called Java Ticker, on the form is a field with the value 'computed for display' to:
dbfile:="GWCollab\\news.ns
viewname:="By Date";
docno:=1;
titlecolumnno:=3;
server:=@Subset(@DbName;1)
cnservername:=@Name([CN];s
db:=server:thispath + "\\" +dbfile;
head:=@DbColumn("":"NoCach
title:=@Subset(@Subset(hea
id:=@DbLookup("":"NoCache"
link:="Notes://" + cnservername + "/" +dbfile +"/0/" + id +"?opendocument" ;
title
An example of the text parameter on the applet is:
dbfile:="GWCollab\\news.ns
viewname:="By Date";
docno:=1;
titlecolumnno:=3;
db:=server:thispath + "\\" +dbfile;
head:=@DbColumn("":"NoCach
texttoshow:=@Subset(@Subse
texttoshow
The link parameter for the above text is:
dbfile:="GWCollab\\news.ns
viewname:="By Date";
docno:=1;
titlecolumnno:=3;
server:=@Subset(@DbName;1)
cnservername:=@Name([CN];s
db:=server:thispath + "\\" +dbfile;
head:=@DbColumn("":"NoCach
title:=@Subset(@Subset(hea
id:=@DbLookup("":"NoCache"
link:="Notes://" + cnservername + "/" +dbfile +"/0/" + id +"?opendocument" ;
link
Note: If this is to work in a mixed Notes 5 & Notes 6 environment, you will have to add a different form for Notes 6 as this type of Java applet will not work correctly in R6
I have an example of this which is fairly easy to follow, but I'm unsure as to how I can display it on this site.
ASKER
Thank you , much.
Thanks for the points, schmad01! I hope this met your needs.
-- b.r.t.
-- b.r.t.
ASKER
Yes, it did. Thanks again.
For running in a client, it would be possible using the NotesTimer class in LotusScript.
You would declare the timer in the form's globals, and initialize and start it in the PostOpen event (or elsewhere, if that suits your needs better). You could store the text for the scrolling in a profile document, which could give you one message for everyone using the database, or one message per user, or one message per day of the week, or some other configuration, depending on how you set it up.
Declare the timer in the globals.
In the PostOpen, initialize it and define the subroutine to function when it triggers. Then create that subroutine to take the text and put some mid$ part of it into a field on the form.
Because Notes will wrap your text by default, you may need to have the display field be in a layout area to control how it appears.
-- b.r.t.