Paging output in Tcl 
Author Message
 Paging output in Tcl

Some time ago, I asked about puting literal text in a Tcl script for
pre-formatted help.  The solutions I received were variations on a theme
that took advantage of the fact that Tcl implicity continues open
strings:

   puts "
      This is some help text
      This is another line of text
      These lines will be put out to the
      screen when this multi-line puts
      is executed.  I can even put Tcl
      variables like $tcl_platform(platform)
      in the text.  Cool."
   # The help text ends with the close quote on the previous line

Alas, some of my help has now gotten so long that I want to page it.  In
csh, I'd do:

   #!/bin/csh -f
   more <<ENDOFTEXT
     This is some text
     this is somre more
     I need a lot to fill up a screen
     ... and so on...
   ENDOFTEXT

but I don't see a clean or easy way to page output in Tcl.  Any
thoughts?

                                 Chris                            

--
Chris Nelson                               As MIT is not "Massachusetts"




Fri, 17 Mar 2000 03:00:00 GMT  
 Paging output in Tcl

Quote:

> Alas, some of my help has now gotten so long that I want to page it.  In
> csh, I'd do:
>    #!/bin/csh -f
>    more <<ENDOFTEXT
>      ... and so on...
>    ENDOFTEXT
> but I don't see a clean or easy way to page output in Tcl.  Any
> thoughts?

if that csh is good enough, how about
        exec more << "
        ...
        "

Quote:
> Chris Nelson                               As MIT is not "Massachusetts"

--
Hume dot Smith at Dess dot Tallships dot iStar dot CA


Fri, 17 Mar 2000 03:00:00 GMT  
 Paging output in Tcl

Quote:


> > Alas, some of my help has now gotten so long that I want to page it.  In
> > csh, I'd do:

> >    #!/bin/csh -f
> >    more <<ENDOFTEXT
> >      ... and so on...
> >    ENDOFTEXT

> > but I don't see a clean or easy way to page output in Tcl.  Any
> > thoughts?

> if that csh is good enough, how about
>         exec more << "
>         ...
>         "

Sorry.  I didn't state all my requirements.  I need to run on NT as well
as UNIX and more doesn't really work the same there.   Hmmm, I wonder if
TclX or some other add-on has a more replacement...?

                                   Chris
--
Chris Nelson                               As MIT is not "Massachusetts"




Fri, 17 Mar 2000 03:00:00 GMT  
 Paging output in Tcl

Quote:

> Some time ago, I asked about puting literal text in a Tcl script for
> pre-formatted help.  The solutions I received were variations on a theme
> that took advantage of the fact that Tcl implicity continues open
> strings:

>    puts "
>       This is some help text
>       This is another line of text
>       These lines will be put out to the
>       screen when this multi-line puts
>       is executed.  I can even put Tcl
>       variables like $tcl_platform(platform)
>       in the text.  Cool."
>    # The help text ends with the close quote on the previous line
//snip//
>                                  Chris

> --
> Chris Nelson                               As MIT is not "Massachusetts"



Chris:

Just a thought, and it may be way off base (comming from a geniue
novice) but...

Suppose you set up and array PageHelp(), then when help is called, you
load
the array with the relevant pages and return a value for the number of
pages.
Then you could call the a proc that would look at the user input and
allow
you to page forward/back/quit. Since you load the array each time,
memory
use is limited to the last pages loaded, not the entire help file. (You
could even flush the array when they quit, set to null or unset the
var.)

I'll leave the real details to the guru's.

"Remember Jim, the Secretary will disavow any knowledge if your mission
fails."

Bob



Fri, 17 Mar 2000 03:00:00 GMT  
 Paging output in Tcl



Quote:

>> if that csh is good enough, how about
>>         exec more << "
>>         ...
>>         "

> Sorry.  I didn't state all my requirements.  I need to run on NT as well
> as UNIX and more doesn't really work the same there.   Hmmm, I wonder if
> TclX or some other add-on has a more replacement...?

Writing an output paging routine can be a real PITA, even when you
know the size of the screen.  Couldn't you pop up a dialog box instead
on NT?  You know that there will be a GUI about somewhere with Win32,
and you can figure out what to do using the tcl_platform array (IIRC)

Donal.
--
Donal K. Fellows   http://r8h.cs.man.ac.uk:8000/    Boing!  Boing!  Boing!

--
I have a really good anti-spam mail filter in use.  Don't bother spamming me...



Tue, 28 Mar 2000 03:00:00 GMT  
 Paging output in Tcl


 (Donal K. Fellows) writes:

: Writing an output paging routine can be a real PITA, even when you
: know the size of the screen.  Couldn't you pop up a dialog box instead
: on NT?  You know that there will be a GUI about somewhere with Win32,
: and you can figure out what to do using the tcl_platform array (IIRC)

I won't bet on GUI. As I just wrote in another message, I'd like to be
able to telnet in to NT just like under Unix...




Wed, 29 Mar 2000 03:00:00 GMT  
 Paging output in Tcl

Quote:


>  (Donal K. Fellows) writes:

> : Writing an output paging routine can be a real PITA, even when you
> : know the size of the screen.  Couldn't you pop up a dialog box instead
> : on NT?  You know that there will be a GUI about somewhere with Win32,
> : and you can figure out what to do using the tcl_platform array (IIRC)

> I won't bet on GUI. As I just wrote in another message, I'd like to be
> able to telnet in to NT just like under Unix...

I was away for a long weekend and my ISP scrolled some of the messages.
I'm not sure if this is the end of a thread I started last week or not.
IAC, I have developed what I consider to be a good mostly-Tcl solution
to paging that works at least on NT and UNIX.  For whatever good it may
do others, the general idea is:

   set fid [open theFile r]
   set theText [read $fid]
   close $fid

we process theText some and have a wrapper around exec but still, the
idea of execing the native more and redirecting a Tcl variable into it
was the key.

                                   Chris

--
Chris Nelson                               As MIT is not "Massachusetts"




Sat, 01 Apr 2000 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. HOW TO CAPTURE AN OUTPUT LINE OF A VHDL OUTPUT IN TCL

2. page break in output - either in pgm or JCL

3. How to decipher windsh output on page faults?

4. Getting postscript output seperated into pages.

5. Canvas Postscript Output - Multiple canvases per page?

6. WANTED: Tcl/Tk man pages in HTML - comp.lang.tcl #8861

7. TclX.n man pages (and pages and pages....)

8. Ruby vs. Tcl input/output question

9. redefine sicstus standard output in to a tcl tk text box

10. tcl/expect script output

11. capturing output of expect send from a tcl script

12. question about catching TCL's output

 

 
Powered by phpBB® Forum Software