From: Tierra <et...@gm...> - 2005-11-29 21:46:04
|
I'm having trouble getting EnsureVisible to work on any new items I've just added to my wxTreeListCtrl. I've played with the sample, and found that it also doesn't work with new items inserted into the wxTreeListCtrl. The problem seems to be that m_x, m_y, etc haven't been calculated on new items just inserted. EnsureVisible calls to those items will actually scroll the window back to (0,0). There is one case where it does work on a new item however (and those wxTreeListItem values have been calculated). That's whenever the new item added is the first child of a parent item (though I'm still not sure why it works in this case). I have been assuming the call to wxYieldIfNeeded() in EnsureVisible (if m_dirty) is there to make sure those values are calculated on new items, but it doesn't seem to help. I've also tried a call to wxYield() in my code after inserting the new item, but before calling EnsureVisible. Nothing so far has helped. The behaviour is the same in both wxWidgets 2.6.1 as well as 2.6.2. I've played with this on an older released version of wxTreeListCtrl as well as CVS with no change (on that note, some kind of version info would be nice to track changes of wxTreeListCtrl). This can all be reproduced by adding an EnsureVisible call to the AppFrame::OnInsertItem method in the wxTreeListCtrl sample in CVS on the new wxTreeListItem returned from InsertItem(). Regards, Bryan Petty |