Code Comments
Programming Forum and web based access to our favorite programming groups.Hi Folks
I've a about Scrolled'TextUndo' and scrolling the text.
If I enter some text in a text-widget without pressing Enter-key and
reaching the last visible line in the widget the text will not be scrolled
down if setting the overstrike mode to false.
If setting overstrike mode to true text will be scrolled.
here my small program:
use strict;
use Tk;
use Tk::TextUndo;
my $mw = MainWindow->new();
my $frame = $mw->Frame()->pack();
my $text = $frame->Scrolled('TextUndo',
-wrap => 'word',
-width => 60,
-height => 5,
)->pack();
$text->OverstrikeMode(1);
MainLoop;
Whats the difference ?
--
Message posted using http://www.talkaboutprogramming.com...ng.com/faq.html
Post Follow-up to this messageOn Mar 25, 7:46 am, "Pit" <pharrend...@am-soft.de> wrote:
> Hi Folks
>
> I've a about Scrolled'TextUndo' and scrolling the text.
>
> If I enter some text in a text-widget without pressing Enter-key and
> reaching the last visible line in the widget the text will not be scrolled
> down if setting the overstrike mode to false.
> If setting overstrike mode to true text will be scrolled.
>
> here my small program:
>
> use strict;
> use Tk;
> use Tk::TextUndo;
>
> my $mw = MainWindow->new();
>
> my $frame = $mw->Frame()->pack();
>
> my $text = $frame->Scrolled('TextUndo',
> -wrap => 'word',
> -width => 60,
> -height => 5,
> )->pack();
>
> $text->OverstrikeMode(1);
>
> MainLoop;
>
> Whats the difference ?
You only have one line of text so there is no "right" thing to do in
this case.
Why does it matter?
Post Follow-up to this messageMy problem is that the entered text isn't visible until pressing the enter or space key if overstrikemode is set to false -- Message posted using http://www.talkaboutprogramming.com...ng.com/faq.html
Post Follow-up to this messagePit schrieb:
> Hi Folks
>
> I've a about Scrolled'TextUndo' and scrolling the text.
>
> If I enter some text in a text-widget without pressing Enter-key and
> reaching the last visible line in the widget the text will not be scrolled
> down if setting the overstrike mode to false.
> If setting overstrike mode to true text will be scrolled.
>
> here my small program:
>
> use strict;
> use Tk;
> use Tk::TextUndo;
>
> my $mw = MainWindow->new();
>
> my $frame = $mw->Frame()->pack();
>
> my $text = $frame->Scrolled('TextUndo',
> -wrap => 'word',
> -width => 60,
> -height => 5,
> )->pack();
>
> $text->OverstrikeMode(1);
>
> MainLoop;
>
> Whats the difference ?
>
> --
> Message posted using http://www.talkaboutprogramming.com...erl.tk
/
> More information at http://www.talkaboutprogramming.com/faq.html
>
Hi,
I posted this in another group some time ago, does it help you?
Christoph
use warnings;
use strict;
use Tk;
use Tk::TextUndo;
package Tk::TextUndo;
sub InsertKeypress
{
my ($w,$char)=@_;
return if $char eq '';
if ($char =~ /^\S$/ and !$w->OverstrikeMode and !$w->tagRanges('sel'))
{
my $index = $w->index('insert');
my $undo_item = $w->getUndoAtIndex(-1);
if (defined($undo_item) &&
($undo_item->[0] eq 'delete') &&
($undo_item->[2] == $index)
)
{
$w->SUPER::insert($index,$char);
$undo_item->[2] = $w->index('insert');
$w->see('insert'); ####### added #########
return;
}
}
$w->addGlobStart;
$w->SUPER::InsertKeypress($char);
$w->addGlobEnd;
}
package main;
my $mw = tkinit;
my $testundo = $mw-> Scrolled ('TextUndo', -wrap => 'word',)-> pack ();
$testundo->OverstrikeMode(0);
MainLoop;
--
use Tk;use Tk::GraphItems;$c=tkinit->Canvas->pack;push@i,Tk::GraphItems->
TextBox(text=>$_,canvas=>$c,x=>$x+=70,y=>100)for(Just=>another=>Perl=>Hacker
);
Tk::GraphItems->Connector(source=>$i[$_],target=>$i[$_+1])for(0..2);
$c->repeat(30,sub{$_->move(0,4*cos($d+=3.16))for(@i)});MainLoop
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.