> The demo worked prety well, except it did not scroll the text
> so I could
> see the end. It looked like you were trying to optimise that and only
as I mentioned, I did copy-n-paste from Tk::Text, so I didn't changed any code.
I only created them in Tcl::Tk::Widget::Text package
these could be created in separate file like in
......\site\lib\Tcl\Tk\Widget\Text.pm
If it was me who wrote the code, I could use different naming conventions:
$w->insertEnd(shift);
$w->seeEnd;
Best regards,
Vadim.
> move it when necessary. I had better results just calling see('end')
> each time.
>
> Regards,
> Jason
>
> Once again, a full working program.
>
>
> use Tcl::Tk;
>
> sub Tcl::Tk::Widget::Text::TIEHANDLE {
> my ($class,$obj) = @_;
> return $obj;
> }
>
> sub Tcl::Tk::Widget::Text::PRINT {
> my $w = shift;
>
> # Loop over all input strings
> while (@_){
> $w->insert('end',shift);
> }
> # Make sure we can see this text
> $w->see('end');
> }
>
> sub Tcl::Tk::Widget::Text::PRINTF {
> my $w = shift;
> $w->PRINT(sprintf(shift,@_));
> }
>
>
> my $int = new Tcl::Tk;
> my $mw = $int->mainwindow;
>
> my $text = $mw->Text->pack;
> my $button = $mw->Button->pack;
> $button->configure(-text => "Tickle me", -command => sub
> {print "Whoaaaa
> Haaa Haaa! " . $count ++ . "\n";});
>
> tie *STDOUT, ref $text, $text;
>
> print "Did you know I was ticklish?\n";
>
>
> $int->MainLoop;
>