Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

The "cutting edge" is getting rather dull. -- Andy Purshottam


devel / comp.lang.tcl / Re: How can I scroll 6,000 text widgets?

SubjectAuthor
* How can I scroll 6,000 text widgets?Luc
+* How can I scroll 6,000 text widgets?Rich
|+* How can I scroll 6,000 text widgets?Ralf Fassel
||`- How can I scroll 6,000 text widgets?Luc
|+* How can I scroll 6,000 text widgets?Luc
||`* How can I scroll 6,000 text widgets?Rich
|| `* How can I scroll 6,000 text widgets?Luc
||  +- How can I scroll 6,000 text widgets?Rich
||  `* How can I scroll 6,000 text widgets?Christian Gollwitzer
||   `- How can I scroll 6,000 text widgets?Luc
|`* How can I scroll 6,000 text widgets?Luc
| `* How can I scroll 6,000 text widgets?Rich
|  `* How can I scroll 6,000 text widgets?Luc
|   `* How can I scroll 6,000 text widgets?Rich
|    `- How can I scroll 6,000 text widgets?Luc
+- How can I scroll 6,000 text widgets?Christian Gollwitzer
`* How can I scroll 6,000 text widgets?Emiliano Gavilan
 `* How can I scroll 6,000 text widgets?Luc
  +- How can I scroll 6,000 text widgets?Rich
  `* How can I scroll 6,000 text widgets?saitology9
   `- How can I scroll 6,000 text widgets?Luc

1
How can I scroll 6,000 text widgets?

<20230126235409.61a23b73@lud1.home>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10602&group=comp.lang.tcl#10602

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: luc...@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: How can I scroll 6,000 text widgets?
Date: Fri, 27 Jan 2023 00:29:14 -0300
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <20230126235409.61a23b73@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="10ce5e7c40a40d77b70242175ea6fbb2";
logging-data="1619681"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QdjLCet9x6A2O3oQqzGmRcDf8Xqz8SUg="
Cancel-Lock: sha1:W5MApqKUUsHl+hK3onWZnly9GY0=
X-Newsreader: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu)
 by: Luc - Fri, 27 Jan 2023 03:29 UTC

That's an eye catching topic title, isn't it?

I've created a monster.

I had this big text widget that didn't suit my purposes.

So I left it where it was and inserted hundreds of text boxes as children
of that one text widget. It looks like a big table or grid.

I know what you're thinking. You're thinking why in the red hot blazes of
this blue round world would anybody do that???

Well, they absolutely need to be separate from all others individually.
They even have their own number IDs each. It's a requirement. And I need
many text editing features including colors.

Everything works except that I can't scroll the monster. I can see the
first half a dozen sets of boxes and can't reach the others.

So I removed the big underlying text widget and used a frame instead.
Silly me, the scroll command won't even work with a frame. Back to the
drawing board.

So I tried a canvas. But it won't scroll either! That's weird. I should
be able to scroll a canvas.

What approach do you recommend in my case?

Additional problem: I can only have so many child text widgets, more or
less 4,200. With 5,000 the application won't load anymore, it crashes
after trying for a few seconds. I wonder if that can be fixed too.

Alright! It's a subtitle editor. One box for subtitle number, another one
for subtitle timestamp, then another one for the original subtitle, one
for the translated subtitle and another one for certain indications
(e.g. character count, errors etc.) A feature length movie can have 1,200
subtitles, that's 6,000 boxes.

--
Luc

Re: How can I scroll 6,000 text widgets?

<tqvoeh$1if79$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10603&group=comp.lang.tcl#10603

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Fri, 27 Jan 2023 05:45:53 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <tqvoeh$1if79$1@dont-email.me>
References: <20230126235409.61a23b73@lud1.home>
Injection-Date: Fri, 27 Jan 2023 05:45:53 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="d6d3d6b39f2b8f510b3f6a837480417b";
logging-data="1653993"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PbqylMdy+Yh4bjP6rEAs4"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:UpsnIMWny8ziLCspO1JJw52ksfM=
 by: Rich - Fri, 27 Jan 2023 05:45 UTC

Luc <luc@sep.invalid> wrote:
> That's an eye catching topic title, isn't it?

Yes, indeed, and unnecessary. :)

> Everything works except that I can't scroll the monster. I can see
> the first half a dozen sets of boxes and can't reach the others.

Again, demo code or else it is not happening.

This scrolls 6000 text widgets just fine:

#!/usr/bin/wish

text .t -yscrollcommand [list .vsb set]
scrollbar .vsb -orient vertical -command [list .t yview]

grid .t .vsb -sticky news

for {set i 0} {$i < 6000} {incr i} {
text .st$i -width 40 -height 5
.t window create end -window .st$i
.t insert end \n
}

So there must be something else interfering.

> So I tried a canvas. But it won't scroll either! That's weird. I should
> be able to scroll a canvas.

For a canvas you have to explicitly tell it the area to scroll,
otherwise it won't scroll at all. Read the manpage carefully.

> What approach do you recommend in my case?

Not creating 6000 text widgets.

> Additional problem: I can only have so many child text widgets, more or
> less 4,200. With 5,000 the application won't load anymore, it crashes
> after trying for a few seconds. I wonder if that can be fixed too.

My code above creates 6000, no crash.

Changing 6000 to 60000 takes a few minutes to run, and consumes 437MB
of memory (according to top). But once up, scrolling to the bottom
happens just fine.

> Alright! It's a subtitle editor. One box for subtitle number, another one
> for subtitle timestamp, then another one for the original subtitle, one
> for the translated subtitle and another one for certain indications
> (e.g. character count, errors etc.) A feature length movie can have 1,200
> subtitles, that's 6,000 boxes.

No, that's 6,000 datapoints, which does not need to equate to 6,000
boxes.

You need enough boxes to fit on screen without scrolling, and you move
the 6,000 datapoints through the smaller set of boxes that are
on screen. The screen boxes let you look through a screen sized
peephole at the 6,000 datapoints, and "scrolling" moves the data
through the peephole.

https://wiki.tcl-lang.org/page/Virtual%20Scrolling

Re: How can I scroll 6,000 text widgets?

<tqvs1c$1j4j6$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10604&group=comp.lang.tcl#10604

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: aurio...@gmx.de (Christian Gollwitzer)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Fri, 27 Jan 2023 07:47:08 +0100
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <tqvs1c$1j4j6$1@dont-email.me>
References: <20230126235409.61a23b73@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 27 Jan 2023 06:47:08 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="f006dbf47c05cb2e3a3d6f22399d5eea";
logging-data="1675878"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+oBs6W44RRGbt8N+0cE8vjiRON5TUzUsw="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.6.1
Cancel-Lock: sha1:bd0BwHcbxNH9pg9cDiRk7JlF+gA=
In-Reply-To: <20230126235409.61a23b73@lud1.home>
 by: Christian Gollwitzer - Fri, 27 Jan 2023 06:47 UTC

Am 27.01.23 um 04:29 schrieb Luc:
> That's an eye catching topic title, isn't it?
>
> I've created a monster.
>
> I had this big text widget that didn't suit my purposes.
>
> So I left it where it was and inserted hundreds of text boxes as children
> of that one text widget. It looks like a big table or grid.
>
> I know what you're thinking. You're thinking why in the red hot blazes of
> this blue round world would anybody do that???
>
> Well, they absolutely need to be separate from all others individually.
> They even have their own number IDs each. It's a requirement. And I need
> many text editing features including colors.

Use tablelist:

https://wiki.tcl-lang.org/page/tablelist

The first screenshot shows one demo with an editable list of widget
properties.

Christian

Re: How can I scroll 6,000 text widgets?

<ygazga48fzz.fsf@akutech.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10605&group=comp.lang.tcl#10605

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralf...@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Fri, 27 Jan 2023 10:48:48 +0100
Lines: 18
Message-ID: <ygazga48fzz.fsf@akutech.de>
References: <20230126235409.61a23b73@lud1.home> <tqvoeh$1if79$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net w8jJgORo29PqZN8NJJs7aQ1w6+a9eRBXcRrEPBmVdAOlfRrPI=
Cancel-Lock: sha1:N13f36vod8Rc2BDMCJzp5+Wilkk= sha1:PrL7R9Mez0yjygg81ifRWVkigvo=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
 by: Ralf Fassel - Fri, 27 Jan 2023 09:48 UTC

* Rich <rich@example.invalid>
| > Additional problem: I can only have so many child text widgets, more or
| > less 4,200. With 5,000 the application won't load anymore, it crashes
| > after trying for a few seconds. I wonder if that can be fixed too.
>
| My code above creates 6000, no crash.
>
| Changing 6000 to 60000 takes a few minutes to run, and consumes 437MB
| of memory (according to top). But once up, scrolling to the bottom
| happens just fine.

Probably the OP is on Windows, where you have additional constraints of
how many graphics handles (the exact term just won't come to mind) you
can create. The limit can be raised by fiddling with the registry, but
there is no guarantee. Only solution is the one suggested by you:
scroll the data, not the widgets.

R'

Re: How can I scroll 6,000 text widgets?

<20230127164308.66a5c516@lud1.home>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10606&group=comp.lang.tcl#10606

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: luc...@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Fri, 27 Jan 2023 16:43:08 -0300
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <20230127164308.66a5c516@lud1.home>
References: <20230126235409.61a23b73@lud1.home>
<tqvoeh$1if79$1@dont-email.me>
<ygazga48fzz.fsf@akutech.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="1a39198ed2c54e76466361a5f04788bb";
logging-data="1924618"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1i6AqEqa6SVCkjVa3zRb9Ly4qI7PLXHY="
Cancel-Lock: sha1:GG9PSQGHY4F4zCeFOacgM669N/Y=
 by: Luc - Fri, 27 Jan 2023 19:43 UTC

On Fri, 27 Jan 2023 10:48:48 +0100, Ralf Fassel wrote:

> Probably the OP is on Windows, where you have additional constraints of
> how many graphics handles (the exact term just won't come to mind) you
> can create.
**************************

No, I use Linux.

I think Rich's reply kind of solves everything. His code indeed works on my
machine, no crash, so I have to rebuild my GUI brick by brick until I sort
things out. I didn't submit any code of my own because it's a very old and
pretty big application split across four files/includes that I repurposed
for this new one.

I also like the idea of scrolling the data rather than the widget, that
will certainly make everything a lot lighter and less prone to crashing.
I looked it up on the wiki, multiple pages deal with that concept, but I
also have an idea of how to implement it in my own way.

Thank you all again.

--
Luc

Re: How can I scroll 6,000 text widgets?

<20230129082910.34b6ddf5@lud1.home>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10614&group=comp.lang.tcl#10614

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: luc...@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Sun, 29 Jan 2023 08:29:10 -0300
Organization: A noiseless patient Spider
Lines: 120
Message-ID: <20230129082910.34b6ddf5@lud1.home>
References: <20230126235409.61a23b73@lud1.home>
<tqvoeh$1if79$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="c56403e4668befe91fdab9adddd9b2cb";
logging-data="2887106"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/nrIrzkNU5og7rc4XUn2+DgJZNyvvTYTw="
Cancel-Lock: sha1:RxSCXd/L7h4qriHhPK7+hNUCl4g=
 by: Luc - Sun, 29 Jan 2023 11:29 UTC

This works:

--------------------
package require Tk

text .t -yscrollcommand [list .vsb set]
scrollbar .vsb -orient vertical -command [list .t yview]
grid .t .vsb -sticky news
focus .t

for {set i 1} {$i <= 600} {incr i} {
frame .st$i -width 40 -height 5
.t window create end -window .st$i
text .st$i.text$i -height 2 -width 50
pack .st$i.text$i
.t insert end \n
.st$i.text$i insert end "this is $i"
} --------------------

This doesn't work:

--------------------
package require Tk

toplevel .scroller -background "#c0c0c0"

text .scroller.t -yscrollcommand [list .scroller.vsb set]
scrollbar .scroller.vsb -orient vertical -command [list .scroller.t yview]
grid .scroller.t .scroller.vsb -sticky news
focus .scroller.t

for {set i 1} {$i <= 600} {incr i} {
frame .st$i -width 40 -height 5
.scroller.t window create end -window .st$i
text .st$i.text$i -height 2 -width 50
pack .st$i.text$i
.scroller.t insert end \n
.st$i.text$i insert end "this is $i"
} --------------------

Why?

--
Luc
>>
**************************
On Fri, 27 Jan 2023 05:45:53 -0000 (UTC), Rich wrote:

> Luc <luc@sep.invalid> wrote:
> > That's an eye catching topic title, isn't it?
>
> Yes, indeed, and unnecessary. :)
>
> > Everything works except that I can't scroll the monster. I can see
> > the first half a dozen sets of boxes and can't reach the others.
>
> Again, demo code or else it is not happening.
>
> This scrolls 6000 text widgets just fine:
>
> #!/usr/bin/wish
>
> text .t -yscrollcommand [list .vsb set]
> scrollbar .vsb -orient vertical -command [list .t yview]
>
> grid .t .vsb -sticky news
>
> for {set i 0} {$i < 6000} {incr i} {
> text .st$i -width 40 -height 5
> .t window create end -window .st$i
> .t insert end \n
> }
>
> So there must be something else interfering.
>
> > So I tried a canvas. But it won't scroll either! That's weird. I should
> > be able to scroll a canvas.
>
> For a canvas you have to explicitly tell it the area to scroll,
> otherwise it won't scroll at all. Read the manpage carefully.
>
> > What approach do you recommend in my case?
>
> Not creating 6000 text widgets.
>
> > Additional problem: I can only have so many child text widgets, more or
> > less 4,200. With 5,000 the application won't load anymore, it crashes
> > after trying for a few seconds. I wonder if that can be fixed too.
>
> My code above creates 6000, no crash.
>
> Changing 6000 to 60000 takes a few minutes to run, and consumes 437MB
> of memory (according to top). But once up, scrolling to the bottom
> happens just fine.
>
> > Alright! It's a subtitle editor. One box for subtitle number, another
> > one for subtitle timestamp, then another one for the original subtitle,
> > one for the translated subtitle and another one for certain indications
> > (e.g. character count, errors etc.) A feature length movie can have
> > 1,200 subtitles, that's 6,000 boxes.
>
> No, that's 6,000 datapoints, which does not need to equate to 6,000
> boxes.
>
> You need enough boxes to fit on screen without scrolling, and you move
> the 6,000 datapoints through the smaller set of boxes that are
> on screen. The screen boxes let you look through a screen sized
> peephole at the 6,000 datapoints, and "scrolling" moves the data
> through the peephole.
>
> https://wiki.tcl-lang.org/page/Virtual%20Scrolling

Re: How can I scroll 6,000 text widgets?

<tr5tdg$2piqi$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10615&group=comp.lang.tcl#10615

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Sun, 29 Jan 2023 13:47:28 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <tr5tdg$2piqi$1@dont-email.me>
References: <20230126235409.61a23b73@lud1.home> <tqvoeh$1if79$1@dont-email.me> <20230129082910.34b6ddf5@lud1.home>
Injection-Date: Sun, 29 Jan 2023 13:47:28 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="dc88019474eaccf49546a08619447910";
logging-data="2935634"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19PfcF5kjeBDB9d/K10mFMv"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:8uhW4pPUtqdubLYo7vOPOcd1+hc=
 by: Rich - Sun, 29 Jan 2023 13:47 UTC

Luc <luc@sep.invalid> wrote:
> This doesn't work:
>
> --------------------
> package require Tk
>
> toplevel .scroller -background "#c0c0c0"
>
> text .scroller.t -yscrollcommand [list .scroller.vsb set]
> scrollbar .scroller.vsb -orient vertical -command [list .scroller.t yview]
> grid .scroller.t .scroller.vsb -sticky news
> focus .scroller.t
>
> for {set i 1} {$i <= 600} {incr i} {
> frame .st$i -width 40 -height 5
> .scroller.t window create end -window .st$i
> text .st$i.text$i -height 2 -width 50
> pack .st$i.text$i
> .scroller.t insert end \n
> .st$i.text$i insert end "this is $i"
> }
> --------------------
>
>
> Why?

Read the text manpage, particularly the section entitled "EMBEDDED
WINDOWS". Pay *very close attention* to the parenthetical clause at
the end of the first paragraph of that section.

Re: How can I scroll 6,000 text widgets?

<20230129191900.19521004@lud1.home>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10626&group=comp.lang.tcl#10626

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: luc...@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Sun, 29 Jan 2023 19:19:00 -0300
Organization: A noiseless patient Spider
Lines: 59
Message-ID: <20230129191900.19521004@lud1.home>
References: <20230126235409.61a23b73@lud1.home>
<tqvoeh$1if79$1@dont-email.me>
<20230129082910.34b6ddf5@lud1.home>
<tr5tdg$2piqi$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="c56403e4668befe91fdab9adddd9b2cb";
logging-data="3103846"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+bziLkoW57pGV16xF8hfwWNP0/NuzM1XM="
Cancel-Lock: sha1:8fw5peyLL4QJVXPmgtMTXEFla5c=
 by: Luc - Sun, 29 Jan 2023 22:19 UTC

On Sun, 29 Jan 2023 13:47:28 -0000 (UTC), Rich wrote:

> Luc <luc@sep.invalid> wrote:
> > This doesn't work:
> >
> > --------------------
> > package require Tk
> >
> > toplevel .scroller -background "#c0c0c0"
> >
> > text .scroller.t -yscrollcommand [list .scroller.vsb set]
> > scrollbar .scroller.vsb -orient vertical -command [list .scroller.t
> > yview] grid .scroller.t .scroller.vsb -sticky news
> > focus .scroller.t
> >
> > for {set i 1} {$i <= 600} {incr i} {
> > frame .st$i -width 40 -height 5
> > .scroller.t window create end -window .st$i
> > text .st$i.text$i -height 2 -width 50
> > pack .st$i.text$i
> > .scroller.t insert end \n
> > .st$i.text$i insert end "this is $i"
> > }
> > --------------------
> >
> >
> > Why?
>
> Read the text manpage, particularly the section entitled "EMBEDDED
> WINDOWS". Pay *very close attention* to the parenthetical clause at
> the end of the first paragraph of that section.
>

Yes, I read that before I asked, and I still don't see the point.
It says:

(subject to the usual rules for geometry management, which require the
text window to be the parent of the embedded window or a descendant of
its parent).

I made the big parent .scroller then made the text widget .scroller.t
then made its big series of numbered children:

..scroller.t window create end -window .st$i

Yet, the error says:

can't embed .st1 in .scroller.t
while executing
".scroller.t window create end -window .st$i"

But .scroller.t is the parent of .st$i. So what is going on? I'm stumped.

--
Luc
>>

Re: How can I scroll 6,000 text widgets?

<tr6v0m$2vged$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10627&group=comp.lang.tcl#10627

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Sun, 29 Jan 2023 23:20:54 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <tr6v0m$2vged$1@dont-email.me>
References: <20230126235409.61a23b73@lud1.home> <tqvoeh$1if79$1@dont-email.me> <20230129082910.34b6ddf5@lud1.home> <tr5tdg$2piqi$1@dont-email.me> <20230129191900.19521004@lud1.home>
Injection-Date: Sun, 29 Jan 2023 23:20:54 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="08296d7872fb79d34cfec617b1c601c7";
logging-data="3129805"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19GUARR9xxW/getVq23UoV8"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:ijOUMBgxnRq1c3uq+Plf4x01rEg=
 by: Rich - Sun, 29 Jan 2023 23:20 UTC

Luc <luc@sep.invalid> wrote:
> On Sun, 29 Jan 2023 13:47:28 -0000 (UTC), Rich wrote:
>
>> Luc <luc@sep.invalid> wrote:
>> > This doesn't work:
>> >
>> > --------------------
>> > package require Tk
>> >
>> > toplevel .scroller -background "#c0c0c0"
>> >
>> > text .scroller.t -yscrollcommand [list .scroller.vsb set]
>> > scrollbar .scroller.vsb -orient vertical -command [list .scroller.t
>> > yview] grid .scroller.t .scroller.vsb -sticky news
>> > focus .scroller.t
>> >
>> > for {set i 1} {$i <= 600} {incr i} {
>> > frame .st$i -width 40 -height 5
>> > .scroller.t window create end -window .st$i
>> > text .st$i.text$i -height 2 -width 50
>> > pack .st$i.text$i
>> > .scroller.t insert end \n
>> > .st$i.text$i insert end "this is $i"
>> > }
>> > --------------------
>> >
>> >
>> > Why?
>>
>> Read the text manpage, particularly the section entitled "EMBEDDED
>> WINDOWS". Pay *very close attention* to the parenthetical clause at
>> the end of the first paragraph of that section.
>>
>
> Yes, I read that before I asked, and I still don't see the point.
> It says:
>
> (subject to the usual rules for geometry management, which require the
> text window to be the parent of the embedded window or a descendant of
> its parent).
>
> I made the big parent .scroller then made the text widget .scroller.t
> then made its big series of numbered children:
>
> .scroller.t window create end -window .st$i
>
>
> Yet, the error says:
>
> can't embed .st1 in .scroller.t
> while executing
> ".scroller.t window create end -window .st$i"
>
> But .scroller.t is the parent of .st$i. So what is going on? I'm stumped.

No, . is the parent of the .st$i windows.

Re: How can I scroll 6,000 text widgets?

<tr7p1m$367qo$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10630&group=comp.lang.tcl#10630

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: aurio...@gmx.de (Christian Gollwitzer)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Mon, 30 Jan 2023 07:45:10 +0100
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <tr7p1m$367qo$1@dont-email.me>
References: <20230126235409.61a23b73@lud1.home> <tqvoeh$1if79$1@dont-email.me>
<20230129082910.34b6ddf5@lud1.home> <tr5tdg$2piqi$1@dont-email.me>
<20230129191900.19521004@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 30 Jan 2023 06:45:10 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="74e9533f079087951bb440edaa10d130";
logging-data="3350360"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/pA6DzlGn34+yviq18B6zWzm0NbJOZczY="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.6.1
Cancel-Lock: sha1:0+XNcOPaMtHmqARaT7i6VL2YBYM=
In-Reply-To: <20230129191900.19521004@lud1.home>
 by: Christian Gollwitzer - Mon, 30 Jan 2023 06:45 UTC

Am 29.01.23 um 23:19 schrieb Luc:
> Yet, the error says:
>
> can't embed .st1 in .scroller.t
> while executing
> ".scroller.t window create end -window .st$i"
>
> But .scroller.t is the parent of .st$i. So what is going on? I'm stumped.

I think you misunderstand what "parent"/"child" is in Tk. It is defined
by the name. A child of .scroller.t would be named, e.g., .scroller.t.st1

In your first example, you used a "sibling" of the text window, not a
child as well.

Christian

Re: How can I scroll 6,000 text widgets?

<20230130070522.0c54707b@lud1.home>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10633&group=comp.lang.tcl#10633

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: luc...@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Mon, 30 Jan 2023 07:05:22 -0300
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <20230130070522.0c54707b@lud1.home>
References: <20230126235409.61a23b73@lud1.home>
<tqvoeh$1if79$1@dont-email.me>
<20230129082910.34b6ddf5@lud1.home>
<tr5tdg$2piqi$1@dont-email.me>
<20230129191900.19521004@lud1.home>
<tr7p1m$367qo$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="c7fba3dbe84e0e71ecb95c19a2e2f3ec";
logging-data="3416199"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1c32hZD9lsyvCkyV/2kRC4luX0RQXcvY="
Cancel-Lock: sha1:+nnvZmCEt9QH62Ba5fKQHVWpNF8=
 by: Luc - Mon, 30 Jan 2023 10:05 UTC

**************************
On Sun, 29 Jan 2023 23:20:54 -0000 (UTC), Rich wrote:

> No, . is the parent of the .st$i windows.

**************************
On Mon, 30 Jan 2023 07:45:10 +0100, Christian Gollwitzer wrote:

> I think you misunderstand what "parent"/"child" is in Tk. It is defined
> by the name. A child of .scroller.t would be named, e.g., .scroller.t.st1
>
> In your first example, you used a "sibling" of the text window, not a
> child as well.
>
> Christian
>
**************************

OK, I understand it now. It's fixed. Thank you.

--
Luc
>>

Re: How can I scroll 6,000 text widgets?

<20230204085734.771b71cb@lud1.home>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10678&group=comp.lang.tcl#10678

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!news.samoylyk.net!nyheter.lysator.liu.se!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: luc...@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Sat, 4 Feb 2023 08:57:34 -0300
Organization: A noiseless patient Spider
Lines: 86
Message-ID: <20230204085734.771b71cb@lud1.home>
References: <20230126235409.61a23b73@lud1.home>
<tqvoeh$1if79$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="edb9112268c19569ff519344f116a034";
logging-data="2062603"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19aGH1WNwatweoCtblvHWcFgAeH726aJoM="
Cancel-Lock: sha1:vzrqNJbqERpwhrN71qhBelo/YOU=
 by: Luc - Sat, 4 Feb 2023 11:57 UTC

Hi, Rich. About the code that you shared, quoted below,
do you have idea of how I can jump to any specific box
and make it immediately visible?

I need something like the [see] command.

All the boxes are children of a text widget, but that
text widget doesn't have any lines of text so I can't
really use the [see] command here.

Less important: how do I scroll that big collection of
boxes without using the mouse? I mean, jump from one
box to the other and scroll accordingly?

--
Luc
>>
**************************
On Fri, 27 Jan 2023 05:45:53 -0000 (UTC), Rich wrote:

> Luc <luc@sep.invalid> wrote:
> > That's an eye catching topic title, isn't it?
>
> Yes, indeed, and unnecessary. :)
>
> > Everything works except that I can't scroll the monster. I can see
> > the first half a dozen sets of boxes and can't reach the others.
>
> Again, demo code or else it is not happening.
>
> This scrolls 6000 text widgets just fine:
>
> #!/usr/bin/wish
>
> text .t -yscrollcommand [list .vsb set]
> scrollbar .vsb -orient vertical -command [list .t yview]
>
> grid .t .vsb -sticky news
>
> for {set i 0} {$i < 6000} {incr i} {
> text .st$i -width 40 -height 5
> .t window create end -window .st$i
> .t insert end \n
> }
>
> So there must be something else interfering.
>
> > So I tried a canvas. But it won't scroll either! That's weird. I should
> > be able to scroll a canvas.
>
> For a canvas you have to explicitly tell it the area to scroll,
> otherwise it won't scroll at all. Read the manpage carefully.
>
> > What approach do you recommend in my case?
>
> Not creating 6000 text widgets.
>
> > Additional problem: I can only have so many child text widgets, more or
> > less 4,200. With 5,000 the application won't load anymore, it crashes
> > after trying for a few seconds. I wonder if that can be fixed too.
>
> My code above creates 6000, no crash.
>
> Changing 6000 to 60000 takes a few minutes to run, and consumes 437MB
> of memory (according to top). But once up, scrolling to the bottom
> happens just fine.
>
> > Alright! It's a subtitle editor. One box for subtitle number, another
> > one for subtitle timestamp, then another one for the original subtitle,
> > one for the translated subtitle and another one for certain indications
> > (e.g. character count, errors etc.) A feature length movie can have
> > 1,200 subtitles, that's 6,000 boxes.
>
> No, that's 6,000 datapoints, which does not need to equate to 6,000
> boxes.
>
> You need enough boxes to fit on screen without scrolling, and you move
> the 6,000 datapoints through the smaller set of boxes that are
> on screen. The screen boxes let you look through a screen sized
> peephole at the 6,000 datapoints, and "scrolling" moves the data
> through the peephole.
>
> https://wiki.tcl-lang.org/page/Virtual%20Scrolling

Re: How can I scroll 6,000 text widgets?

<trm05j$21m69$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10681&group=comp.lang.tcl#10681

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Sat, 4 Feb 2023 16:12:35 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <trm05j$21m69$1@dont-email.me>
References: <20230126235409.61a23b73@lud1.home> <tqvoeh$1if79$1@dont-email.me> <20230204085734.771b71cb@lud1.home>
Injection-Date: Sat, 4 Feb 2023 16:12:35 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7265f935036fde54e64ccf11e6a10ae2";
logging-data="2152649"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Xc3Jz5PXbfwkCgen/R8oN"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:hMiZewgDJoNEwmHjsZKzPAyoWe8=
 by: Rich - Sat, 4 Feb 2023 16:12 UTC

Luc <luc@sep.invalid> wrote:
> Hi, Rich. About the code that you shared, quoted below,
> do you have idea of how I can jump to any specific box
> and make it immediately visible?
>
> I need something like the [see] command.

The parent text widget holding all the embedded windows has a [see]
command. Use that.

> All the boxes are children of a text widget, but that
> text widget doesn't have any lines of text so I can't
> really use the [see] command here.

Ah, study the code more closely. You will see that each embedded
window is one line in the text widget.

Also study the text widget man page, specifically the index option
"pathName".

> Less important: how do I scroll that big collection of boxes without
> using the mouse? I mean, jump from one box to the other and scroll
> accordingly?

If keyboard scrolling is not already working using the standard Tk
bindings, then you'll need to setup your own custom bindings on
specific keys actuations to effect scrolling.

Do keep in mind that when keyboard focus is inside an embedded window
that this fact may cause the parent to not 'hear' some of the relevant
keyboard events.

Also, please don't put your quoted message underneath a line containing
just two hyphens and a space, that denotes a "signature" on Usenet, and
standard clients omit quoting the signature when replying.

Re: How can I scroll 6,000 text widgets?

<20230205004453.3a087ed7@lud1.home>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10682&group=comp.lang.tcl#10682

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: luc...@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Sun, 5 Feb 2023 00:44:53 -0300
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <20230205004453.3a087ed7@lud1.home>
References: <20230126235409.61a23b73@lud1.home>
<tqvoeh$1if79$1@dont-email.me>
<20230204085734.771b71cb@lud1.home>
<trm05j$21m69$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="9fef498537c48d77ef1557dece1f401e";
logging-data="2469804"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/HwXpC89UzuMLLNmGSLyHXXJltQpsqcfk="
Cancel-Lock: sha1:GE6nLrDHBE3CJOr2+/1UdBo9SIM=
 by: Luc - Sun, 5 Feb 2023 03:44 UTC

**************************
On Sat, 4 Feb 2023 16:12:35 -0000 (UTC), Rich wrote:

> Luc <luc@sep.invalid> wrote:
> > Hi, Rich. About the code that you shared, quoted below,
> > do you have idea of how I can jump to any specific box
> > and make it immediately visible?
> >
> > I need something like the [see] command.
>
> The parent text widget holding all the embedded windows has a [see]
> command. Use that.
>
> > All the boxes are children of a text widget, but that
> > text widget doesn't have any lines of text so I can't
> > really use the [see] command here.
>
> Ah, study the code more closely. You will see that each embedded
> window is one line in the text widget.
>
> Also study the text widget man page, specifically the index option
> "pathName".
>
> > Less important: how do I scroll that big collection of boxes without
> > using the mouse? I mean, jump from one box to the other and scroll
> > accordingly?
>
> If keyboard scrolling is not already working using the standard Tk
> bindings, then you'll need to setup your own custom bindings on
> specific keys actuations to effect scrolling.
>
> Do keep in mind that when keyboard focus is inside an embedded window
> that this fact may cause the parent to not 'hear' some of the relevant
> keyboard events.
>
> Also, please don't put your quoted message underneath a line containing
> just two hyphens and a space, that denotes a "signature" on Usenet, and
> standard clients omit quoting the signature when replying.

Yeah, well, now I see you put a line break after every box.
I didn't. That's why I couldn't move around comfortably.

I guess that will change the game in scrolling too. I'm surprised it even
scrolled at all though only with the mouse.

Thank you again.

--
Luc
>>

Re: How can I scroll 6,000 text widgets?

<trndhn$2c3sp$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10683&group=comp.lang.tcl#10683

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Sun, 5 Feb 2023 05:07:03 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <trndhn$2c3sp$1@dont-email.me>
References: <20230126235409.61a23b73@lud1.home> <tqvoeh$1if79$1@dont-email.me> <20230204085734.771b71cb@lud1.home> <trm05j$21m69$1@dont-email.me> <20230205004453.3a087ed7@lud1.home>
Injection-Date: Sun, 5 Feb 2023 05:07:03 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="41cfc58d42fae3e739f0714e3abbd04d";
logging-data="2494361"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+guHktsEigDbQAtcxYUSx9"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:PADn7bQ7xEANdBEZev6MNuQnjBk=
 by: Rich - Sun, 5 Feb 2023 05:07 UTC

Luc <luc@sep.invalid> wrote:
> **************************
>
>
> Yeah, well, now I see you put a line break after every box.
> I didn't. That's why I couldn't move around comfortably.

Ah, you ended up with a huge single long line with 'word wrap' giving
you the vertical aligment. That's why you could not scroll. Doing
that causes the text to consume a huge amount of CPU time computing
word wrapping.

> I guess that will change the game in scrolling too. I'm surprised it
> even scrolled at all though only with the mouse.

Yes, one widget per line means no overlong lines, and no O(N^2) (or
worse) complexity factor computing what should appear on screen after a
scroll.

But, as you'll likely more often than not have keyboard focus inside
the inner widgets, you will likely have to build your own keyboard
scrolling bindings.

An alternate would be for you to rethink your approach, back up, and
use something like tablelist (https://www.nemethi.de/) which has much
of what you'll need to recreate yourself already written and ready to
use (including editing within cells).

Re: How can I scroll 6,000 text widgets?

<20230205044137.11d4d992@lud1.home>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10684&group=comp.lang.tcl#10684

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: luc...@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Sun, 5 Feb 2023 04:41:37 -0300
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <20230205044137.11d4d992@lud1.home>
References: <20230126235409.61a23b73@lud1.home>
<tqvoeh$1if79$1@dont-email.me>
<20230204085734.771b71cb@lud1.home>
<trm05j$21m69$1@dont-email.me>
<20230205004453.3a087ed7@lud1.home>
<trndhn$2c3sp$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="9fef498537c48d77ef1557dece1f401e";
logging-data="2538270"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+GHbNtsdFUhDRSot/X/gJCSe8Bh1tjW80="
Cancel-Lock: sha1:YDIA4P5mAas5GkJBrF1qr8eOqis=
 by: Luc - Sun, 5 Feb 2023 07:41 UTC

On Sun, 5 Feb 2023 05:07:03 -0000 (UTC), Rich wrote:

> Ah, you ended up with a huge single long line with 'word wrap' giving
> you the vertical aligment. That's why you could not scroll. Doing
> that causes the text to consume a huge amount of CPU time computing
> word wrapping.

Actually, the whole thing is taking a little longer to load/build now.
But it's a very small difference. It's definitely worth it as it fixes
the problems I was having before.


> But, as you'll likely more often than not have keyboard focus inside
> the inner widgets, you will likely have to build your own keyboard
> scrolling bindings.

Nope. As I Key-Tab from one box to another, that triggers a proc that
uses [see] to adjust the big text widget and make sure that the current
box is always in the ideal position. I am one happy camper!

> An alternate would be for you to rethink your approach, back up, and
> use something like tablelist (https://www.nemethi.de/) which has much
> of what you'll need to recreate yourself already written and ready to
> use (including editing within cells).

I will have to disagree. I investigated tablelist some time ago and
found it terribly complicated. I couldn't even make it work. You know
that I am a little thick, but I accomplish my goals with many things
including canvases or SQLite. The tablelist package is extraordinarily
difficult.

I know the author hangs around here. Sorry.

More importantly, I need the degree of familiarity and control that the
stock text widget gives me. My boxes are overloaded with multiple kinds
of witchcraft that let me type significantly faster. I can't afford the
learning curve of porting my warm and fuzzy witchcraft to a package
I am extremely not familiar with. Stock Tk does the job extremely well.
I just haven't mastered all the neat tricks it can play.

--
Luc
>>

Re: How can I scroll 6,000 text widgets?

<20230206112003.2e19a82a064a418732778744@gmail.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10687&group=comp.lang.tcl#10687

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: emiliano...@gmail.com (Emiliano Gavilan)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Mon, 6 Feb 2023 11:20:03 -0300
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <20230206112003.2e19a82a064a418732778744@gmail.com>
References: <20230126235409.61a23b73@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="05ae3b76b9df753b915f5014009efef5";
logging-data="3280434"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bJZljwguFhmDD1M4+3IEqlX1/uKXhdE0="
Cancel-Lock: sha1:bARh514h0JX3mBuE52YZp96wxtM=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu)
 by: Emiliano Gavilan - Mon, 6 Feb 2023 14:20 UTC

On Fri, 27 Jan 2023 00:29:14 -0300
Luc <luc@sep.invalid> wrote:

> That's an eye catching topic title, isn't it?
>
> I've created a monster.
>
> I had this big text widget that didn't suit my purposes.
>
> So I left it where it was and inserted hundreds of text boxes as children
> of that one text widget. It looks like a big table or grid.
>
> I know what you're thinking. You're thinking why in the red hot blazes of
> this blue round world would anybody do that???
>
> Well, they absolutely need to be separate from all others individually.
> They even have their own number IDs each. It's a requirement. And I need
> many text editing features including colors.
>
> Everything works except that I can't scroll the monster. I can see the
> first half a dozen sets of boxes and can't reach the others.
>
> So I removed the big underlying text widget and used a frame instead.
> Silly me, the scroll command won't even work with a frame. Back to the
> drawing board.
>
> So I tried a canvas. But it won't scroll either! That's weird. I should
> be able to scroll a canvas.
>
> What approach do you recommend in my case?

What's the point of creating such a high count of text widgets when you
can only use one at the time?

I would just create a single one, either permanent or on-demand, and map
or unmap it as desired on the different areas of text.

Using a combination of tags and bindings it's easy to do what you want.

>
> Additional problem: I can only have so many child text widgets, more or
> less 4,200. With 5,000 the application won't load anymore, it crashes
> after trying for a few seconds. I wonder if that can be fixed too.
>
> Alright! It's a subtitle editor. One box for subtitle number, another one
> for subtitle timestamp, then another one for the original subtitle, one
> for the translated subtitle and another one for certain indications
> (e.g. character count, errors etc.) A feature length movie can have 1,200
> subtitles, that's 6,000 boxes.
>
> --
> Luc
>

--
Emiliano Gavilan

Re: How can I scroll 6,000 text widgets?

<20230207070912.47167082@lud1.home>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10694&group=comp.lang.tcl#10694

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: luc...@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Tue, 7 Feb 2023 07:09:12 -0300
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <20230207070912.47167082@lud1.home>
References: <20230126235409.61a23b73@lud1.home>
<20230206112003.2e19a82a064a418732778744@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="a8db725e75772e63d434858e5c8bd78d";
logging-data="3708856"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ZoGC1y79D1F7b6IsunnmWXk+OhbDldUw="
Cancel-Lock: sha1:Gih84h/1BaZSdn92aF/yPDvALPk=
 by: Luc - Tue, 7 Feb 2023 10:09 UTC

On Mon, 6 Feb 2023 11:20:03 -0300, Emiliano Gavilan wrote:

> What's the point of creating such a high count of text widgets when you
> can only use one at the time?
>
> I would just create a single one, either permanent or on-demand, and map
> or unmap it as desired on the different areas of text.
>
> Using a combination of tags and bindings it's easy to do what you want.

You are probably right, but I was in a hurry and went with the first
design that occurred to me. Perfect or not, it's working very well. I'm
having two very productive weeks with it. I'm surprised I could get it
to work so well in so little time. I may redesign it in the future.
There are quite a few rough edges yet though so I'll probably work on
those first.

--
Luc
>>

Re: How can I scroll 6,000 text widgets?

<trto0i$3p9ek$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10697&group=comp.lang.tcl#10697

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Tue, 7 Feb 2023 14:42:26 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <trto0i$3p9ek$1@dont-email.me>
References: <20230126235409.61a23b73@lud1.home> <20230206112003.2e19a82a064a418732778744@gmail.com> <20230207070912.47167082@lud1.home>
Injection-Date: Tue, 7 Feb 2023 14:42:26 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="470a57478d3a71cdf513d54daec6a371";
logging-data="3974612"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18CpWKfqEfyJBjf2apQinei"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:1sD0HK8+eTVkQwen1t/tfXQpDHA=
 by: Rich - Tue, 7 Feb 2023 14:42 UTC

Luc <luc@sep.invalid> wrote:
> On Mon, 6 Feb 2023 11:20:03 -0300, Emiliano Gavilan wrote:
>
>> What's the point of creating such a high count of text widgets when you
>> can only use one at the time?
>>
>> I would just create a single one, either permanent or on-demand, and map
>> or unmap it as desired on the different areas of text.
>>
>> Using a combination of tags and bindings it's easy to do what you want.
>
>
> You are probably right, but I was in a hurry and went with the first
> design that occurred to me. Perfect or not, it's working very well.
> I'm having two very productive weeks with it. I'm surprised I could
> get it to work so well in so little time. I may redesign it in the
> future. There are quite a few rough edges yet though so I'll
> probably work on those first.

In your text widget UI, do you have a grid layout of cells, i.e.
something like:

.entry1 | .entry2 | .entry3
.entry4 | .entry5 | .entry6

If so, then switching from a "long text with 6000 entry widgets" to
"just enough entries to fit on screen" and scrolling the data through
the widgets you might find the Tcllib 'matrix' data structure to be
useful.

Specifically it lets you extract a "rectangle" of cells, and that
'rectangle' (appropriately sized) is exactly the data you'd want to
display in the fixed set of widgets sized for the screen.

Scrolling then becomes a matter of keeping track of a row offset (or
row and column if you also have horizontal scrolling) in the matrix for
the top row of data presently in the display and a proc to do the
appropriate fill of the entries (plus another to map changes back into
the matrix for storage).

Re: How can I scroll 6,000 text widgets?

<trtue1$3qf1a$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10698&group=comp.lang.tcl#10698

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: saitolo...@gmail.com (saitology9)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Tue, 7 Feb 2023 11:32:01 -0500
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <trtue1$3qf1a$1@dont-email.me>
References: <20230126235409.61a23b73@lud1.home>
<20230206112003.2e19a82a064a418732778744@gmail.com>
<20230207070912.47167082@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 7 Feb 2023 16:32:01 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="1986122b46c43998f6cb7b582f9e03ac";
logging-data="4013098"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18058YXv++n0C9iDHDJZrja"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.3.2
Cancel-Lock: sha1:2lV+bc2YSS8cBmvou54tauSp9XU=
In-Reply-To: <20230207070912.47167082@lud1.home>
Content-Language: en-US
 by: saitology9 - Tue, 7 Feb 2023 16:32 UTC

On 2/7/2023 5:09 AM, Luc wrote:

> design that occurred to me. Perfect or not, it's working very well. I'm
> having two very productive weeks with it. I'm surprised I could get it
>
That is interesting. After all, this is what it all comes down to at the
end: whether something is useful to you or not. is this some kind of a
personal productivity app?

Re: How can I scroll 6,000 text widgets?

<20230208080930.011f71d1@lud1.home>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10708&group=comp.lang.tcl#10708

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: luc...@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: How can I scroll 6,000 text widgets?
Date: Wed, 8 Feb 2023 08:09:30 -0300
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <20230208080930.011f71d1@lud1.home>
References: <20230126235409.61a23b73@lud1.home>
<20230206112003.2e19a82a064a418732778744@gmail.com>
<20230207070912.47167082@lud1.home>
<trtue1$3qf1a$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader01.eternal-september.org; posting-host="45e976706d11c5c7f17d83c490c32880";
logging-data="173092"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Lrcm51nIqYoFkZb6spyHW/+JvuSlmEvQ="
Cancel-Lock: sha1:wcaqWN3yMV2HOpnoxzBoIVZ8tIE=
 by: Luc - Wed, 8 Feb 2023 11:09 UTC

On Tue, 7 Feb 2023 11:32:01 -0500, saitology9 wrote:

> On 2/7/2023 5:09 AM, Luc wrote:
>
> > design that occurred to me. Perfect or not, it's working very well. I'm
> > having two very productive weeks with it. I'm surprised I could get it
> >
> That is interesting. After all, this is what it all comes down to at the
> end: whether something is useful to you or not. is this some kind of a
> personal productivity app?

Yes, it's for my own work routine. It's helping me a lot.

--
Luc
>>

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor