Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Preserving view while item being scrolled is growing
I have a need to view a log file that is constantly growing in length.
Data is being viewed in a Scrolled Text widget (Scrolled("Text")).

When I first start, I populate the Text widget with everything in the
file, and then effectively 'tail' it, adjusting srollbar using yview so
that user sees end of log file (i.e. bottom of text widget). This works.

But what is a way to preserve the view when the user manually scrolls up
to view an earlier part of the text? It is rather annoying to have yview
send him back to the bottom when new data is appended.

Mucho TIA,
TP


Report this thread to moderator Post Follow-up to this message
Old Post
Tony P
11-17-04 08:58 PM


Re: Preserving view while item being scrolled is growing
Tony P wrote:
> I have a need to view a log file that is constantly growing in length.
> Data is being viewed in a Scrolled Text widget (Scrolled("Text")).
>
> When I first start, I populate the Text widget with everything in the
> file, and then effectively 'tail' it, adjusting srollbar using yview so
> that user sees end of log file (i.e. bottom of text widget). This works.
>
> But what is a way to preserve the view when the user manually scrolls up
> to view an earlier part of the text? It is rather annoying to have yview
> send him back to the bottom when new data is appended.
>
> Mucho TIA,
> TP
>

Sounds like you are trying to do two mutually exclusive things.

If I was doing somthing similar, I would track the location of
the cursor versus the end of the file. If the cursor ('insert'
mark) is within 80 lines of the end, scroll the display on append,
if not, don't. Depending on how much and how fast data is added
to the file you may want to make it 20 or 200 or whatever.

If you want to examine the file, scroll up a page or two and
set the cursor. To go back to following the tail, scroll to the
end and set the cursor.

Insert some code in the tail routine similar to:

my $scrollthreshold = 80;
my ($endline, $endcol) = split/\./, $text->index('end');
my ($cursorline,$cursorcol) = split/\./,  $text->index('insert');
$text->see('end') if (($endline - $cursorline) < $scrollthreshold);

Report this thread to moderator Post Follow-up to this message
Old Post
thundergnat
11-17-04 08:58 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PerlTk archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:03 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.