[wxPython] EVT_SCROLLWIN_LINEUP

Can't catch EVT_SCROLLWIN_LINEUP in a scrolled window. Also
EVT_SCROLL_LINEUP and EVT_COMMAND_SCROLL_LINEUP is not to catch
(so I've to use EVT_CHAR). EVT_SCROLLWIN is to see.
For efficient scrolling I want only redraw the visible area, but
there's an interaction with the scrolling, so the paint is crippled.
A solution is the following:

    EVT_SCROLLWIN(self, self.OnScroll)
    ...

  def OnScroll(self, event):
    type= event.GetEventType()
    if type == wxEVT_SCROLLWIN_LINEUP:
      pos= self.GetScrollPos(wxHORIZONTAL) -1
      if pos < 0:
        pos= 0
    elif type == wxEVT_SCROLLWIN_LINEDOWN:
      pos= self.GetScrollPos(wxHORIZONTAL) +1
      if pos > self.GetScrollRange(wxHORIZONTAL):
        pos= self.GetScrollRange(wxHORIZONTAL)
    else:
      pos= event.GetPosition()
    self.SetScrollPos(wxHORIZONTAL, pos)
    #####no event.Skip()
    self.Refresh()

  def OnPaint(self,event):
    dc.BeginDrawing()
    view_start= self.GetViewStart()
    view_start= (view_start[0]*self.scru, view_start[1]*self.scru)
    view= self.GetClientSizeTuple()
    view_end= (view_start[0]+view[0], view_start[1]+view[1])
    ...

(Python2.0/wxPython2.3.1/MSW98)

regards, Udo Floegel

For efficient scrolling I want only redraw the visible area, but
there's an interaction with the scrolling, so the paint is crippled.

For an example of another approach take a look at demo/ColourDB.py

···

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