2013-09-16 75 views
0

我想獲得一個列表滾動後的初始點後,其結果是刪除所有項目和重新填充的行動。蟒蛇wx.listctrl滾動位置

我想獲取滾動位置記錄,然後回到它,但GetScrollPos總是返回0由於某種原因。

我一直在尋找所有的ListCtrl方法,但似乎無法找到方法,並且還注意到GetScrollPos不存在,但它也沒有引發異常。

+0

您確定您提供正確的方向嗎? 'GetScrollPos(int orientation)const' – Arthur

回答

4

我通過計算底部物品並在上面的物品上使用EnsureVisible得到了它的工作效果,因爲EnsureVisible總是在目標物之下顯示額外物品(如果有的話)。

完美的作品,不需要GetScrollPos因爲我很確定沒有SetScrollPos

list_total = list.GetItemCount() 
list_top = list.GetTopItem() 
list_pp  = list.GetCountPerPage() 
list_bottom = min(list_top + list_pp, list_total - 1) 
list.EnsureVisible((list_bottom - 1)) 
+0

我相信'list.EnsureVisible(list.GetItemCount() - 1)'也可以做這個工作 – prgDevelop