Home > Archive > PerlTk > June 2004 > Delete all in a Text widget
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Delete all in a Text widget
|
|
| Matthew Braid 2004-05-18, 11:31 pm |
| Hi all,
Is there a way around the extreme slowness of a Tk::Text box when you want to
delete everything inside it (not just a few lines)?
I've already started deleting/inserting in a line-by line fashion in my
programs, but the problem still surfaces when a user selects everything and hits
the delete key.
This applies to large contents. I tried it with 6MB of data. Using the
line-by-line delete approach it took 4 seconds to empty the Text box. Using the
'delete the whole lot at once' the program apparently froze and had to be killed
off after 10 minutes.
TIA,
MB
| |
| $_@_.%_ 2004-05-19, 2:31 am |
|
Matthew Braid <mb@uq.net.au.invalid> wrote in message-id:
<c8egfb$cg$1@bunyip.cc.uq.edu.au>
>
>Hi all,
>
>Is there a way around the extreme slowness of a Tk::Text box when you want to
>delete everything inside it (not just a few lines)?
>
>I've already started deleting/inserting in a line-by line fashion in my
>programs, but the problem still surfaces when a user selects everything and hits
>the delete key.
>
>This applies to large contents. I tried it with 6MB of data. Using the
>line-by-line delete approach it took 4 seconds to empty the Text box. Using the
>'delete the whole lot at once' the program apparently froze and had to be killed
>off after 10 minutes.
>
>TIA,
>MB
Hm, not sure if it would work.. but what if you destroy the text widget,
then create a new one; would this be quicker?
| |
| Dieter D'Hoker 2004-05-19, 9:31 am |
| Matthew Braid wrote:
> Hi all,
>
> Is there a way around the extreme slowness of a Tk::Text box when you
> want to delete everything inside it (not just a few lines)?
>
> I've already started deleting/inserting in a line-by line fashion in
> my programs, but the problem still surfaces when a user selects
> everything and hits the delete key.
>
> This applies to large contents. I tried it with 6MB of data. Using the
> line-by-line delete approach it took 4 seconds to empty the Text box.
> Using the 'delete the whole lot at once' the program apparently froze
> and had to be killed off after 10 minutes.
you are using $widget->Contents(""); for the 'delete the whole lot at once'
?
--
Dieter D'Hoker
news:free.nl.dieter.dhoker & news:alt.nl.fan.dieter.dhoker
Multiplayer tetris? http://www.tsrv.com/
| |
| Matthew Braid 2004-05-19, 9:31 pm |
| Dieter D'Hoker wrote:
> Matthew Braid wrote:
>
>
>
> you are using $widget->Contents(""); for the 'delete the whole lot at once'
> ?
>
>
No, just good old delete. Especially $txt->delete('1.0', 'end'). Contents does
this internally anyway.
I've started writing an override for Tk::Text's insert and delete functions, but
I was kind of hoping this had been dealt with already.
MB
| |
| Matthew Braid 2004-06-07, 3:56 am |
| Slaven Rezic wrote:
> Matthew Braid <mb@uq.net.au.invalid> wrote in message news:<c8egfb$cg$1@bunyip.cc.uq.edu.au>...
>
>
>
> Which Tk version? This belongs to the class of problems where upgrading
> might help...
>
> Regards,
> Slaven
Tk version 800.025. At the moment I can't upgrade to the 804 branch because
wmCapture and wmRelease are broken in 804 and I use both for one of my programs
(I'm in the process of upgrading my code so I don't need them any more).
BTW - is there any form of Text box that doesn't have any concept of tags? Just
a simple 'display/enter text and allow a selection, but don't support other tags
etc' that might be a little lighter?
MB
|
|
|
|
|