STR #3293

GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 1.3 | Post Text | Post File | Prev | Next ]

STR #3293

Application:FLTK Library
Status:5 - New
Priority:2 - Low, e.g. a documentation error or undocumented side-effect
Scope:3 - Applies to all machines and operating systems
Subsystem:Core Library
Summary:show_item_top() causes tree redraw position bug
Version:1.3.4
Created By:mikesart
Assigned To:Unassigned
Fix Version:Unassigned
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Post File ]
Name/Time/Date Filename/Size top right image
 
#1 mikesart
07:37 Mar 08, 2016
fl_tree.png
113k
 
bottom left image   bottom right image

Trouble Report Comments:

Post Text ]
Name/Time/Date Text top right image
 
#1 mikesart
07:37 Mar 08, 2016
This is with 10304. Make the following changes to test/tree.cxx:

mikesart@mikesart-mint:~/rad/gitwin/fltk (master *)$ diff -u test/tree.cxx /tmp/tree.bug.cxx
--- test/tree.cxx       2016-03-06 17:03:25.277577418 -0800
+++ /tmp/tree.bug.cxx   2016-03-06 16:54:11.765559732 -0800
@@ -108,7 +108,7 @@
   tree->add("Bbb/child-01");
   tree->add("Bbb/child-01/111");
   tree->add("Bbb/child-01/222");
-  tree->add("Bbb/child-01/333");
+  Fl_Tree_Item *itemxx = tree->add("Bbb/child-01/333");
   tree->add("Bbb/child-02");
   tree->add("Bbb/child-03");
   tree->add("Bbb/child-04");
@@ -216,10 +216,17 @@
       sprintf(s, "500 Items/item %04d", t+1);
       tree->add(s);
   }
-  tree->close("500 Items");    // close the 500 items by default
+  static int i = 0;
   
+  if ( i++ & 0x1 )
+      tree->close("500 Items");        // close the 500 items by default
+  else
+      tree->open("500 Items"); // close the 500 items by default
+
   AssignUserIcons();

+
+  itemxx->select();
+  tree->show_item_top( itemxx );
   tree->redraw();
 }

When you hit the RebuildTree button, it should oscillate between a lot of items and a vertical scrollbar, and few items and no scrollbar.

When you go from few items and no scrollbar to scrollbar, it draws the ROOT item in the middle of the tree control. Screenshot attached.

Making this change in Fl_Tree.cxx fixes the issue, but I haven't gone through the code enough to know whether it's the right fix or not.

@@ -1143,6 +1148,7 @@ void Fl_Tree::clear() {
   delete _root; _root = 0;
   _item_focus = 0;
   _lastselect = 0;
+  _vscroll->range( 0, 0 );
 }

Thanks!
 
bottom left image   bottom right image

Return to Bugs & Features | Post Text | Post File ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2021 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.