[wxpython-users] wx.Grid - TopRow

Raffaello Barella barbarossa.platz at gmail.com
Fri Apr 4 08:34:29 PDT 2008


Something different from MakeCellVisible(), Tim, that "brings the specified
cell into the visible grid cell area with minimal scrolling". I want to put
it at the TOP of the cell area.
But you gave me an idea, so I wrote this function for my derived wx.grid:

    def SetTopRow(self, row):
        assert row < self.GetNumberRows()
        col =3D self.GetGridCursorCol()
        PixelsPerUnit =3D self.GetScrollPixelsPerUnit()
        CellRect =3D self.CellToRect(row, 0)
        x =3D CellRect[0] / PixelsPerUnit[0]
        y =3D (CellRect[1]  - CellRect[3]) / PixelsPerUnit[1]
        self.Scroll(x, y)
        #  wx.grid derives also from wx.ScrolledWindow

Tested, it works.
So long.



2008/4/4, Tim van der Leeuw <tnleeuw at gmail.com>:
>
> Hi Raffaello,
>
> On Fri, Apr 4, 2008 at 12:33 PM, Raffaello Barella <
> barbarossa.platz at gmail.com> wrote:
>
> > Is there a command that puts line y at the top of the visible grid cell
> > area, or that enables to scroll the cell area down to the desired point?
> >
>
> You mean something different from EnsureCellVisible()? Or is that what you
> were looking for?
>
> Regards,
>
> --Tim
>
>
> >
> > _______________________________________________
> > wxpython-users mailing list
> > wxpython-users at lists.wxwidgets.org
> > http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
> >
> >
>
> _______________________________________________
> wxpython-users mailing list
> wxpython-users at lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200804=
04/f22ebce2/attachment.htm


More information about the wxpython-users mailing list