scrolledPanel - controlling the scrollbar.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

scrolledPanel - controlling the scrollbar.

Donn Ingle
Hello all,
Thanks for all the help with my wee app so far. I have crossed-off so many
little problems with the help of the good people on this list and the hard
work that has gone into the wxPython demo.

I am using the wx.lib.scrolledpanel.ScrolledPanel for a control that draws
fonts down its length. After a while a scrollbar appears, which is correct.

When the user is viewing a font waaaay down the list (they have scrolled)
and they choose it (click) then press another button - the app does stuff
and this results in the panel having to be entirely redrawn. (objects
destroyed and re-created)

Now, that presents the user with the same list of fonts, but where they were
looking only a moment before has been disrupted by the abrupt shift of the
view back to the top.

Is there some way I can record the position of the scrollbar and then
restore the wx.lib.scrolledpanel.ScrolledPanel to the same position it was
in before I had to re-draw it?

/d



Reply | Threaded
Open this post in threaded view
|

Re: scrolledPanel - controlling the scrollbar.

Robin Dunn
Donn Ingle wrote:

> Hello all,
> Thanks for all the help with my wee app so far. I have crossed-off so many
> little problems with the help of the good people on this list and the hard
> work that has gone into the wxPython demo.
>
> I am using the wx.lib.scrolledpanel.ScrolledPanel for a control that draws
> fonts down its length. After a while a scrollbar appears, which is correct.
>
> When the user is viewing a font waaaay down the list (they have scrolled)
> and they choose it (click) then press another button - the app does stuff
> and this results in the panel having to be entirely redrawn. (objects
> destroyed and re-created)
>
> Now, that presents the user with the same list of fonts, but where they were
> looking only a moment before has been disrupted by the abrupt shift of the
> view back to the top.
>
> Is there some way I can record the position of the scrollbar

        xPos, yPos = sp.GetViewStart()


> and then
> restore the wx.lib.scrolledpanel.ScrolledPanel to the same position it was
> in before I had to re-draw it?

        sp.Scroll(xPos, yPos)


--
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!



Reply | Threaded
Open this post in threaded view
|

Re: scrolledPanel - controlling the scrollbar.

Donn Ingle
Robin Dunn wrote:
> xPos, yPos = sp.GetViewStart()
> sp.Scroll(xPos, yPos)
Thanks once again, Sir Dunn !

/d