Tk Library Source Code

View Ticket
Login
Ticket UUID: 1885638
Title: Tree "see" problem in some situations
Type: Bug Version: None
Submitter: exgerhardr Created on: 2008-02-03 12:12:36
Subsystem: bwidget Assigned To: damonc
Priority: 2 Severity:
Status: Closed Last Modified: 2009-07-10 09:20:35
Resolution: Works For Me Closed By: sf-robot
    Closed on: 2009-07-10 02:20:35
Description:
The BWidget Tree object has problems with "see" in some situations.
Example code:
 
  pack [set sw [ScrolledWindow .sw]]
  set lb [Tree $sw.lb]
  $sw setwidget $lb
  for {set i 0} {$i<100} {incr i} {
    if {$i} {
      $lb insert end  "Item_[expr ($i-1)/10]" "Item_$i" -text "This is item $i"
      } else {
      $lb insert end root "Item_$i" -text "This is item $i"
     }
  } 
  $lb itemconfigure Item_0 -open 1
  $lb itemconfigure Item_2 -open 1
  $lb selection set Item_27
  ### update ; ### "see" works correct with update
  $lb see Item_27

The Item_27 is scrolled outside by one line (Item_28 is the 1st visible leaf). 

See also bug report #1885621 regarding ListBox "see".
In simpler situations (e.g. only 1 level tree like in ListBox example) Tree widget does "see" scroll correct. 

Tested on BWidget 1.8.
User Comments: sf-robot added on 2009-07-10 09:20:35:

allow_comments - 1

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).

oehhar added on 2009-06-25 22:33:07:
Changed state to pending due to optional fix state

oehhar added on 2009-06-10 15:51:32:
Might be fixed.
Workaround seams feasable.

oehhar added on 2009-06-03 14:59:48:
Bug confirmed, but acceptable by design.
Please use "update idletasks" to update widget sizes before using the see subcommand.

oehhar added on 2009-06-03 14:50:50:
Thank you for the bug report.
I have tried your script on windows and on Linux.
In both cases, Item_27 is visible. The items are on two lines for me, making the display quite cluttering and results in a slightly clipped item 27 at the bottom.

Maybee, my default fonts or sizes are different than yours.

My thoughts about the update solution:
tk requires "update idletasks" to evaluate required screen sizes, so scrollwindow may not work without an update. So an update might be required by design.

update is always a tradeoff, because other tasks (like after or file events) may occur withoin the update. For this reason, it is often helpful, if updates are coded manualy (and not within BWidget library), so you are able to control them.

In consequence, your update solution may be a good solution.