Canvas with _really_ long textes 
Author Message
 Canvas with _really_ long textes

Hi everybody.

I've got a problem using the canvas widget.
I want to display long string (about 50000 characters and more).
The text is inserted with "createText".

The canvas the scrollbar are drawn corrected,
but at a arbitary position the content of the
canvas widget is not updated anymore (e.g only
about the first 5775 characters are drawn correctly).
When scrolling further to the right the canvas
contents stays the same as before.

This little test program shows the effect:

-------snip --------------

#!/vol/perl/bin/perl

use Tk;

$mw = MainWindow->new();
$mw->title("canvastest");

$canvas = $mw->Canvas();

for ($i = 0; $i < 5000; $i++) {
    $text .= "test $i";

Quote:
}

print STDERR index($text, "735te"), "\n";
$canvas->createText (0, 50,  -text=>$text);
$canvas->configure (-scrollregion => [ $canvas->bbox("all") ]);

$sc = $mw->Scrollbar(-orient => 'horizontal');
$sc->configure (-command => ['xview' => $canvas]);
$canvas->configure (-xscrollcommand => ['set' => $sc]);
$canvas->pack(-side => "top", -anchor => "w", -expand => "1",
-fill=>"x");
$sc->pack(-side => "bottom", -expand => "1", -fill => "x");

MainLoop;

-------snap------------

Some information about the system:

Perl   :  5.005_02
perlTK : 800.015

Tested OS:
- Solaris 2.6/x86 (Pentium)
- Solaris 2.6/Sparc (UltraSparc I)
- solaris 2.6/Sparc (Enterprise 450)
- Solaris 2.7/Sparc (UltraSparc 5)

Please send me an answer if  anyone knows how to
solve this problem. It's important for the application
not to split up the string into several parts. The strings
i've tested are rather short, compared to the real data
(may go up to several mega characater....).

Burkhard Linke



Sun, 07 Jul 2002 03:00:00 GMT  
 Canvas with _really_ long textes

Quote:

> Hi everybody.

> I've got a problem using the canvas widget.
> I want to display long string (about 50000 characters and more).
> The text is inserted with "createText".

> The canvas the scrollbar are drawn corrected,
> but at a arbitary position the content of the
> canvas widget is not updated anymore (e.g only
> about the first 5775 characters are drawn correctly).
> When scrolling further to the right the canvas
> contents stays the same as before.

> This little test program shows the effect:

> -------snip --------------

[...]

> -------snap------------

> Some information about the system:

> Perl   :  5.005_02
> perlTK : 800.015

> Tested OS:
> - Solaris 2.6/x86 (Pentium)
> - Solaris 2.6/Sparc (UltraSparc I)
> - solaris 2.6/Sparc (Enterprise 450)
> - Solaris 2.7/Sparc (UltraSparc 5)

> Please send me an answer if  anyone knows how to
> solve this problem. It's important for the application
> not to split up the string into several parts. The strings
> i've tested are rather short, compared to the real data
> (may go up to several mega characater....).

I found these lines in tkCanvUtil.c:

    if (tmp > 32767) {
        *drawableXPtr = 32767;
    } else if (tmp < -32768) {
        *drawableXPtr = -32768;
    } else {
        *drawableXPtr = (short) tmp;
    }

Maybe you can tweak the C source to use larger numbers. Good luck!

Regards,
        Slaven

--
use Tk;$c=tkinit->Canvas(-he,20)->grid;$x=5;map{s!\n!!g;map{create$c 'line'=>
map{$a=-43+ord;($x+($a>>3)*2=>5+($a&7)*2)}split''}split"!";$x+=12}split/_/=>'K
PI1_+09IPK_K;-OA1_+K!;A__1;Q!7G_1+QK_3CLPI90,_+K!;A_+1!KQ!.N_K+1Q!.F_1+KN.Q__1+
KN._K+1Q!.F_1+KN.Q_+1Q__+1!KQ!.N_1;Q!7G_K3,09Q_+1!K.Q_K+1Q!.F_1+KN.Q_';MainLoop



Sun, 07 Jul 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. really really Simple Question

2. Really, really BIG files with MacPerl

3. tying a widget in one canvas to the scrolling of another canvas

4. Converting PC longs to Sun longs

5. long long in perl?

6. XS typemap for long long?

7. long long in perl??

8. Perl support for the long long type

9. perl script wanted - egrep 'really|long|list|of|words'

10. What does $foo=*bar really mean?

11. Extracting data in a really ugly format question.

12. Is setlogsock really in Perl 5.004_04?

 

 
Powered by phpBB® Forum Software