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 |
From: Tierra <et...@gm...> - 2005-11-30 02:39:02
|
I've tracked down the bug and fixed it, see patch: http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D1369702&group_= id=3D51305&atid=3D462818 Regards, Bryan Petty |
From: Otto W. <ott...@or...> - 2005-12-01 21:54:27
|
Tierra wrote: >reproduced by adding an EnsureVisible call to the >AppFrame::OnInsertItem method in the wxTreeListCtrl sample in CVS on >the new wxTreeListItem returned from InsertItem(). > > > I've added the EnsureVisible call after the Insert in OnInsertItem but can't understand your problem. As long as there is a current item I can insert or add as much as I want. If the current item is outside the window (make the window smaller) EnsureVisible scrolls it into the window. Can you give me a better test description? O. Wyss -- Application guidelines: http://freshmeat.net/projects/wyoguide/ Cross-platform Editor: http://freshmeat.net/projects/wyoeditor/ Cross-platform Filemanager http://freshmeat.net/projects/wyofiler/ |
From: Tierra <et...@gm...> - 2005-12-02 05:27:07
|
On 12/1/05, Otto Wyss <ott...@or...> wrote: > Tierra wrote: > >reproduced by adding an EnsureVisible call to the > >AppFrame::OnInsertItem method in the wxTreeListCtrl sample in CVS on > >the new wxTreeListItem returned from InsertItem(). > > I've added the EnsureVisible call after the Insert in OnInsertItem but > can't understand your problem. As long as there is a current item I can > insert or add as much as I want. If the current item is outside the > window (make the window smaller) EnsureVisible scrolls it into the > window. Can you give me a better test description? Looking at your changes here... http://cvs.sourceforge.net/viewcvs.py/wxcode/wxCode/components/treelistctrl= /samples/treelisttest/treelisttest.cpp?r1=3D1.21&r2=3D1.23 That is all that was needed, and looks correct (the second commit you made anyway, v1.23, not v1.22). If that's not giving you issues, I'll need more time to look this over when I get back into work tomorrow. Now that I think about it, it's possible it only happens when both the current item and the new one are scrolled well out of the repaint area. I was testing by selecting the last item in the default tree in the sample, resizing the window to maybe about a quarter to a half of the size so the selected item was out of the view, then selecting insert from the menu. If you still can't come up with something, I'll put in some further testing tomorrow. I realized that I didn't mention I'm on MSW in any of these posts or the patch description if that makes any difference (I can't see how it would though). Regards, Bryan Petty |
From: Otto W. <ott...@or...> - 2005-12-01 22:03:14
|
Sorry, I now understand. O. Wyss -- Application guidelines: http://freshmeat.net/projects/wyoguide/ Cross-platform Editor: http://freshmeat.net/projects/wyoeditor/ Cross-platform Filemanager http://freshmeat.net/projects/wyofiler/ |
From: Otto W. <ott...@or...> - 2005-12-02 17:19:01
|
Tierra wrote: >Looking at your changes here... >http://cvs.sourceforge.net/viewcvs.py/wxcode/wxCode/components/treelistctrl/samples/treelisttest/treelisttest.cpp?r1=1.21&r2=1.23 > > > Whenever the Y-pos is needed as in this case, the positions have to be calculated since through different actions (adding, deleting, expanding, etc) any Y-pos might be wrong. So it's best if the all the positions were just calculated before. In the case of inserting an item this means the positions are calculated twice but this seems bearable. Position calculation is now done only before the Y-pos is needed and in OnIdle, therefore ExpandAll should now be a little faster. I've just tried to expand all with the WindowsExplorer on a 100 folder/4000file directory and it takes for ages, I had to kill the explorer. I also tried it with wyoFiler but it neither seems to work. Is anybody able to profile the wxTreeListCtrl? O. Wyss -- Application guidelines: http://freshmeat.net/projects/wyoguide/ Cross-platform Editor: http://freshmeat.net/projects/wyoeditor/ Cross-platform Filemanager http://freshmeat.net/projects/wyofiler/ |
From: Tierra <et...@gm...> - 2005-12-02 21:40:27
|
On 12/2/05, Otto Wyss <ott...@or...> wrote: > Whenever the Y-pos is needed as in this case, the positions have to be > calculated since through different actions (adding, deleting, expanding, > etc) any Y-pos might be wrong. So it's best if the all the positions > were just calculated before. In the case of inserting an item this means > the positions are calculated twice but this seems bearable. Position > calculation is now done only before the Y-pos is needed and in OnIdle, > therefore ExpandAll should now be a little faster. I've confirmed that fixes my problem. > I've just tried to expand all with the WindowsExplorer on a 100 > folder/4000file directory and it takes for ages, I had to kill the > explorer. I also tried it with wyoFiler but it neither seems to work. Is > anybody able to profile the wxTreeListCtrl? My usage typically only works with trees with about 50-100 items on average. So I'm not really going to be able to give you useful numbers without writing up test case code. I currently use Compuware DevPartner Profiler (free useful MSVC profiler available) and would recommend it. Regards, Bryan Petty |