Scrolling text [message #18292] |
Thu, 16 December 1999 00:00  |
Kelly Dean
Messages: 92 Registered: March 1997
|
Member |
|
|
CIRA setup a monitor in their lobby to display the satellite imagery
from GOES-E and GOES-W. They are using some of our web pages to to do
this.
I think I could make a better display with IDL. One of the items in the
display would be scrolling the local forecast from our EMWIN ingest into
a text widget. I now how to read the text file and parse out the Fort
Collins forecast with IDL, but how would I get the text to slowly scroll
through the forecast in a text widget?
Kelly
|
|
|
Re: Scrolling text [message #18372 is a reply to message #18292] |
Sat, 18 December 1999 00:00  |
Peter Mason
Messages: 145 Registered: June 1996
|
Senior Member |
|
|
Peter Mason <menakkis@my-deja.com> wrote:
> (..without really thinking..)
Oops, sorry Kelly I really botched the DEVICE calls graphics scroll
method there. I have appended a little test program that demonstrates
this technique, in case you'd like to try it out. (It does the
honours with a text file.) The scrolling speed will be affected by
your computer's hardware and will go faster with 8-bit colour depth than
24-bit. If it scrolls too slowly you could try creating the main
window with RETAIN=0 (always a speed-up) and/or knocking out the WAIT.
I tried it with IDL's true-type fonts and, to my surprise, this slowed
things down a lot on my P2/300 machine - there's a noticeable delay
while each line is rendered with XYOUTS. But perhaps try this as well
and see what you think.
Cheers
Peter Mason
; ============================================================ ==
; A little program to demonstrate smooth text scrolling.
; Peter Mason, Dec. 99
; The one and only parameter is the filename of an ASCII
; file - this file gets read and displayed.
pro tscroll,tfile
if n_elements(tfile) eq 0 then tfile='tscroll.pro'
t=''
openr,u,tfile,/get_lun,err=e
if e ne 0 then return
gx=512L &gy=320L ;main window size
ty=16L ;pixmap window height
window,0,xsiz=gx,ysiz=gy,retain=1 ;retain=0 for max speed
window,1,xsiz=gx,ysiz=ty,/pixmap ;room for 1 line of text
while not eof(u) do begin
readf,u,t
wset,1 &erase
xyouts,0,3,t,/dev,font=0 ;render the next line
wset,0
for j=0L,ty-1L do begin ;copy the text-line to
device,copy=[0,0,gx,gy-1,0,1] ;the main window one
device,copy=[0,ty-j-1,gx,1,0,0,1] ;pixel-line at a time
;wait,0.02
endfor
j=get_kbrd(0)
if keyword_set(j) then goto,bye ;escape hatch
endwhile
bye:
free_lun,u
wdelete,1
return
end
Sent via Deja.com http://www.deja.com/
Before you buy.
|
|
|