wxGrid Synchronising Scroll Bars

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ayebegum
    New Member
    • Mar 2007
    • 3

    #1

    wxGrid Synchronising Scroll Bars

    Hello,

    I have a problem : (

    I have two grids both of which have scrollbars which as i understand it, are automatically handled by wxGrid.

    What i need is to bind the scrollbars so when one is moved to a certain position the other one should move there too.

    So i'm guessing it needs to be something like this -
    Code:
        EVT_SCROLL(self.grid, self.OnScroll()) #self.grid is one grid and self.plan is the other
    
        def OnScroll(self):
                x, y = #NEED A WAY OF GETTING THE X,Y POSITION OF THE SCROLL BAR
                self.plan.Scroll(x, y)
                self.plan.AdjustScrollbars()
    
    #HAVE A SIMILAR THING FOR THE OTHER SCROLL BAR
    I don't know how to get the x and y position.

    Any suggestions?

    Many thanks,

    Ayesha
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by ayebegum
    Hello,

    I have a problem : (

    I have two grids both of which have scrollbars which as i understand it, are automatically handled by wxGrid.

    What i need is to bind the scrollbars so when one is moved to a certain position the other one should move there too.

    So i'm guessing it needs to be something like this -
    Code:
        EVT_SCROLL(self.grid, self.OnScroll()) #self.grid is one grid and self.plan is the other
    
        def OnScroll(self):
                x, y = #NEED A WAY OF GETTING THE X,Y POSITION OF THE SCROLL BAR
                self.plan.Scroll(x, y)
                self.plan.AdjustScrollbars()
    
    #HAVE A SIMILAR THING FOR THE OTHER SCROLL BAR
    I don't know how to get the x and y position.

    Any suggestions?

    Many thanks,

    Ayesha
    Check the docs for wxScrollEvent. You get the orientation and the positions separately from the event.

    Comment

    • bartonc
      Recognized Expert Expert
      • Sep 2006
      • 6478

      #3
      Originally posted by bartonc
      Check the docs for wxScrollEvent. You get the orientation and the positions separately from the event.
      I'll post my way of communicating between two widgets on the same frame/panel when you reply.

      Comment

      Working...