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

Question about TK::TextUndo and Scrollbar
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


Report this thread to moderator Post Follow-up to this message
Old Post
Pit
03-25-08 01:07 PM


Re: Question about TK::TextUndo and Scrollbar
On 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?

Report this thread to moderator Post Follow-up to this message
Old Post
smallpond
03-27-08 12:29 AM


Re: Question about TK::TextUndo and Scrollbar
My 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


Report this thread to moderator Post Follow-up to this message
Old Post
Pit
03-27-08 09:48 AM


Re: Question about TK::TextUndo and Scrollbar
Pit 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

Report this thread to moderator Post Follow-up to this message
Old Post
Ch Lamprecht
03-29-08 12:15 AM


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 07:51 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.