[wxPython] Scrolling problems...

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

[wxPython] Scrolling problems...

Sam Pumphrey
Hi all,

According to the wxWindows documentation, every wxWindow has built in scrollbars and if these are set, wxScrollbarEvents are sent out... However it doesn't appear that this is happening;

1) the _StdOnScrollCallbacks (wx.py) is not being called for a wxWindow class (windows.py)

2) even if I put this line in myself, the OnScroll member is never called.

[basically I just need some way of being told when a scroll bar event happens so that I can redraw the screen.]

If I use a wxScrolledWindow class then OnPaint is called on every scroll event, as I need, *but* it seems to clear the whole window on each scroll which is highly undesirable. Furthermore, the OnScroll function of a wxScrolledWindow is never called either. (And as a side point, I noticed last time I tried it that the OnDraw function was not called either... only OnPaint).

This is quite frustrating behaviour as all I'd like to do is just know when the scrollbars have moved so I can blit my background, and it doesn't look like I can achieve this currently.

Any ideas? Is this a known problem?

Cheers,

Sam

------------------------------------------------------
   Sam Pumphrey - Project SPIRIT, AT&T Research UK
 Email: [hidden email] - Tel: (01223) 343215
------------------------------------------------------
 

Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] Scrolling problems...

Sam Pumphrey
> If I use a wxScrolledWindow class then OnPaint is called on every
> scroll event, as I need, *but* it seems to clear the whole window on
> each scroll which is highly undesirable. Furthermore, the OnScroll
> function of a wxScrolledWindow is never called either. (And as a side
> point, I noticed last time I tried it that the OnDraw function was not
> called either... only OnPaint).

It seems OnScroll *is* actually called for windows, but not in gtk.
<sigh>

Sam


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] Scrolling problems...

Robin Dunn
In reply to this post by Sam Pumphrey
> According to the wxWindows documentation, every wxWindow has built
> in scrollbars and if these are set, wxScrollbarEvents are sent out...
> However it doesn't appear that this is happening;
>
> 1) the _StdOnScrollCallbacks (wx.py) is not being called for a
> wxWindow class (windows.py)
>
> 2) even if I put this line in myself, the OnScroll member is
> never called.

I'll look into this...


> If I use a wxScrolledWindow class then OnPaint is called on every
> scroll event, as I need, *but* it seems to clear the whole window
> on each scroll which is highly undesirable. Furthermore, the
> OnScroll function of a wxScrolledWindow is never called either.

Try overriding OnEraseBackground to do nothing.


> (And as a side point, I noticed last time I tried it that the
> OnDraw function was not called either... only OnPaint).

Since OnDraw is not generated directly from an event, but is a virtual that
must be overridden, wxPython doesn't support it.  Since it is only a
convenience version of EVT_PAINT it is no great loss.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] Scrolling problems...

Sam Pumphrey
> > If I use a wxScrolledWindow class then OnPaint is called on every
> > scroll event, as I need, *but* it seems to clear the whole window
> > on each scroll which is highly undesirable. Furthermore, the
> > OnScroll function of a wxScrolledWindow is never called either.
>
> Try overriding OnEraseBackground to do nothing.

Thanks. This seems to work fine in windows, but has no effect in gtk :-(...


> > (And as a side point, I noticed last time I tried it that the
> > OnDraw function was not called either... only OnPaint).
>
> Since OnDraw is not generated directly from an event, but is a virtual that
> must be overridden, wxPython doesn't support it.  Since it is only a
> convenience version of EVT_PAINT it is no great loss.

I thought it was something like that.

Thanks, Sam

PS.
wxDC.Blit works fine in MSW with wxCOPY. Odd that it doesn't work with wxSET.
;-)



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users




Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] Scrolling problems...

Robin Dunn
> PS.
> wxDC.Blit works fine in MSW with wxCOPY. Odd that it doesn't work with
wxSET.
> ;-)

My guess is that the underlying toolkits treat it differently.  The wx
logical functions just map to some toolkit values.

Robin



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users