Patches item #1369702, was opened at 2005-11-29 19:37
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=462818&aid=1369702&group_id=51305
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Bryan Petty (bpetty)
Assigned to: Nobody/Anonymous (nobody)
Summary: [wxTreeListCtrl] Bugfix for EnsureVisible on new items
Initial Comment:
The Bug: Positions stored in each wxTreeListItem are
not calculated on new items until OnPaint. This becomes
a problem if you want to scroll to the new item before
OnPaint after you've created it (ie: calling
EnsureVisible on your new item).
Without this patch, the current code doesn't check for
this and will scroll the window to (0,0) (the initial
position values for all new wxTreeListItems). While
there's a couple ways this could of been fixed, this
patch takes the non-obtrusive route fixing the problem
without requiring changes in code that uses
wxTreeListCtrl as well as avoiding any current API changes.
The Patch: This code simply adds a variable to
wxTreeListItem to keep track of when the positions have
been calculated. wxTreeListMainWindow was then changed
to update that value after calculating the positions
via either CalculatePositions() or during OnPaint()
(PaintLevel() to be specific). EnsureVisible() was then
changed to check if the item passed in has had it's
positions calculated. If it hasn't, it calculates them
(using CalculatePositions()), then continues to scroll
to the item. This should avoid adding any unnecessary
calculations slowing down existing code unless those
calculations are necessary to ensure an item is visible.
Please note that I didn't look through the rest of the
functions to check if any others are guilty of using
un-calculated wxTreeListItem positions like
EnsureVisible was, and it's possible other
functionality needs to be changed to do the same. So if
the same problem comes up elsewhere, this should be a
good place to look.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=462818&aid=1369702&group_id=51305
|