[pygtk] Restore a scrolling position
zeploum at gmail.com
Thu Feb 19 22:09:39 WST 2009
Thank for your reply but I don't think it might fit my usecase as the
TreeView might be refreshed without any selected cell.
1) The user scroll at the bottom without selecting anything
2) The user trigger a refresh action
3) What will happen with your method ?
Anyway, thanks for the suggestion
On Thu, Feb 19, 2009 at 1:23 PM, Walter Leibbrandt
<walter at translate.org.za>wrote:
> If you are changing the store, I would suggest a different approach:
> This would require you to have some way to identify any given row uniquely
> (unless the first "matching" row is acceptable) and also to "remember" the
> selected row before performing your update. Then you can use
> gtk.TreeView.scroll_to_cell() to scroll back to the remembered row. Using
> scroll_to_cell(path, column, True, 0.5, 0.5) you can get the remembered row
> nice and centered (if possible). See the docs () for more details on the
> Lionel Dricot wrote:
>> In a previous mail, I asked about restoring the scrolling position in a
>> treeview :
>> This was solved thanks to Neil and Walter with the following line of codes
>> at the end of my refresh function :
>> (with values being read at the start of the refresh function, of course)
>> But I discovered a problem : if elements have been removed from the
>> treeview, the scroll will go to an empty position.
>> In some case, it means that you will see only a blank treeview because
>> remaining elements are hidden on top (but no scrollbar are displayed).
>> So how can check before inserting the scroll_value that I didn't pass the
>> upper bound of the possible scroll ?
> Walter Leibbrandt http://translate.org.za/blogs/walter
> Software Developer +27 12 460 1095 (w)
> Recent blogs:
> * Virtaal's MVCisation
> * Things that changed the way I code
> * Switching from Subversion to git
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pygtk