f



tcl/tk 8.4 text widget question

Hi!
Can you help.
I have a gui script that displays the output of commands as they are
ran in a text widget with scroll bar. However, once the output goes
past the height of the text widget, the text does not automatically
scroll down.  When the processing is complete, I have to scroll to the
bottom to see the last few lines including the line where it says
"Processing complete"

Does anyone know how to fix this?
Meg Cooper
0
2/25/2009 5:20:10 PM
comp.lang.tcl 23428 articles. 2 followers. Post Follow

6 Replies
854 Views

Similar Articles

[PageSpeed] 38

mulkey_mouse@cox.net wrote:
> Hi!
> Can you help.
> I have a gui script that displays the output of commands as they are
> ran in a text widget with scroll bar. However, once the output goes
> past the height of the text widget, the text does not automatically
> scroll down.  When the processing is complete, I have to scroll to the
> bottom to see the last few lines including the line where it says
> "Processing complete"
> 
> Does anyone know how to fix this?
> Meg Cooper

Try...

$txt see end

.... after you add each new line of text.

Jeff
0
jeff_godfrey (836)
2/25/2009 5:32:44 PM
Hey!! Thanks!! It worked like a charm.


---------- Forwarded message ----------
From: Jeff Godfrey <jeff_godf...@pobox.com>
Date: Feb 25, 12:32=A0pm
Subject: tcl/tk 8.4 text widget question
To: comp.lang.tcl


mulkey_mo...@cox.net wrote:
> Hi!
> Can you help.
> I have a gui script that displays the output of commands as they are
> ran in a text widget with scroll bar. However, once the output goes
> past the height of the text widget, the text does not automatically
> scroll down. =A0When the processing is complete, I have to scroll to the
> bottom to see the last few lines including the line where it says
> "Processing complete"

> Does anyone know how to fix this?
> Meg Cooper

Try...

$txt see end

.... after you add each new line of text.

Jeff
0
2/25/2009 5:47:06 PM
On Feb 25, 11:32 am, Jeff Godfrey <jeff_godf...@pobox.com> wrote:
> mulkey_mo...@cox.net wrote:
> > Hi!
> > Can you help.
> > I have a gui script that displays the output of commands as they are
> > ran in a text widget with scroll bar. However, once the output goes
> > past the height of the text widget, the text does not automatically
> > scroll down.  When the processing is complete, I have to scroll to the
> > bottom to see the last few lines including the line where it says
> > "Processing complete"
>
> > Does anyone know how to fix this?
> > Meg Cooper
>
> Try...
>
> $txt see end
>
> ... after you add each new line of text.
>
> Jeff

.... but if you want a user friendly solution, only do that if the user
hasn't moved the scrollbar (or another way to look at it: only if the
last line is visible). In other words, if the view is scrolled to the
bottom, auto-scroll. If not, don't. There's nothing I hate more than
seeing something in a log, scrolling back to see it, and having the
program jerk the view back to the bottom.

0
oakley (2074)
2/25/2009 6:05:51 PM
Bryan Oakley wrote:
> On Feb 25, 11:32 am, Jeff Godfrey <jeff_godf...@pobox.com> wrote:
>> mulkey_mo...@cox.net wrote:
>>> Hi!
>>> Can you help.
>>> I have a gui script that displays the output of commands as they are
>>> ran in a text widget with scroll bar. However, once the output goes
>>> past the height of the text widget, the text does not automatically
>>> scroll down.  When the processing is complete, I have to scroll to the
>>> bottom to see the last few lines including the line where it says
>>> "Processing complete"
>>> Does anyone know how to fix this?
>>> Meg Cooper
>> Try...
>>
>> $txt see end
>>
>> ... after you add each new line of text.
>>
>> Jeff
> 
> ... but if you want a user friendly solution, only do that if the user
> hasn't moved the scrollbar (or another way to look at it: only if the
> last line is visible). In other words, if the view is scrolled to the
> bottom, auto-scroll. If not, don't. There's nothing I hate more than
> seeing something in a log, scrolling back to see it, and having the
> program jerk the view back to the bottom.
> 

amen, brother!

bruce
0
2/25/2009 9:55:55 PM
On Feb 25, 1:05 pm, Bryan Oakley <oak...@bardo.clearlight.com> wrote:
> On Feb 25, 11:32 am, Jeff Godfrey <jeff_godf...@pobox.com> wrote:
>
>
>
> > mulkey_mo...@cox.net wrote:
> > > Hi!
> > > Can you help.
> > > I have a gui script that displays the output of commands as they are
> > > ran in a text widget with scroll bar. However, once the output goes
> > > past the height of the text widget, the text does not automatically
> > > scroll down.  When the processing is complete, I have to scroll to the
> > > bottom to see the last few lines including the line where it says
> > > "Processing complete"
>
> > > Does anyone know how to fix this?
> > > Meg Cooper
>
> > Try...
>
> > $txt see end
>
> > ... after you add each new line of text.
>
> > Jeff
>
> ... but if you want a user friendly solution, only do that if the user
> hasn't moved the scrollbar (or another way to look at it: only if the
> last line is visible). In other words, if the view is scrolled to the
> bottom, auto-scroll. If not, don't. There's nothing I hate more than
> seeing something in a log, scrolling back to see it, and having the
> program jerk the view back to the bottom.



It sure would be great to have a megawidget which made this behavior
the default. Anyone know of one that does this?
0
lvirden (1938)
2/26/2009 11:43:45 AM

Why create a megawidget this is only TWO lines of tcl !

 set yview [lindex [$TextWidget yview] 1]
 $TextWidget insert end $newtext
 if {$yview == 1} {
   $TextWidget see end
 }


I add an else to the if to change the color of something to show new
text arriving but this needs an extra 2 lines to change the color back
when the scrollbar returns to the end.


Martyn
0
msedit (170)
2/27/2009 9:18:52 AM
Reply: