Menu

#2140 text widget: window create ... -create ... doesn't work

obsolete: 8.6b1
open
8
2009-10-20
2006-10-21
No

In Tk 8.5, the text widget command

<path> window create <index> -create <script>

doesn't behave as expected. From the man page:

"... this script will be evaluated when the annotation
is about to be displayed on the screen. ... If the
annotation's window should ever be deleted, script will
be evaluated again the next time the annotation is
displayed."

In earlier Tk versions, the window's creation was
delayed indeed as specified in the man page, i.e.,
until effectively displaying it on the screen. This
was a very useful feature, allowing the creation of a
large number of embedded windows, of which only a few
had to really exist. For example, whenever vertical
scrolling or anything else made it necessary to update
the view, it was possible to destroy the windows
embedded into the other lines. A very effective way to
save resources and avoid problems related to keyboard
navigation with the Tab key (which becomes awfully slow
in the presence of a large number of windows).

In Tk 8.5, the "-create" option behaves basically like
"-window". The [window names] subcommand returns the
names of *all* embedded windows, and it is quite easy
to see that all of these really exist. Any attempt to
delete some of them fails, because they are immediately
recreated, contrary to what is stated in the documentation.

Discussion

  • Csaba Nemethi

    Csaba Nemethi - 2006-10-29
    • assigned_to: hobbs --> vincentdarley
     
  • Csaba Nemethi

    Csaba Nemethi - 2009-10-20

    Any chance to see this annoying bug fixed in the near future?

     
  • Csaba Nemethi

    Csaba Nemethi - 2009-10-20
    • milestone: 595235 --> obsolete: 8.6b1
    • priority: 5 --> 8
     
  • Donal K. Fellows

    Bluntly, there's not much chance of fixing this unless we can find someone who really groks the (now horrendously complex) text widget code in enough detail. My suspicion/hunch is that it'll be hard to fix because we now need the dimensions of the embedded windows much earlier so that we can get smooth scrolling right.

     
  • Francois VOGEL

    Francois VOGEL - 2012-05-17

    Test script:

    pack [text .t]
    for {set i 1} {$i < 100} {incr i} {
    .t insert end $i\t$i--$i--$i--$i--$i\n
    }
    proc cremwin {} {
    puts "NOW running the -create script"
    return [entry .t.e2]
    }
    # create embedded window out of the currently visible area
    # In Tk 8.5 the message displays as soon as we hit enter
    # on next line - BUG
    # In Tk 8.4 the message displays only when scrolling down
    # so that line 50 becomes visible - OK
    .t window create 50.5 -create cremwin

     
MongoDB Logo MongoDB