wxGrid's extension that allows rearranging grid's columns + headings ?

Hi Guys,

Do you know of an extension to wxGrid -

  • that will allow rearranging the grid’s columns as well as the columns’ headings ?
  • that would anchor one column in place while allowing the other columns to be moved ?
    Thanks,
    Ron.

Barak, Ron wrote:

Hi Guys,

Do you know of an extension to wxGrid -

* that will allow rearranging the grid's columns as well
as the columns' headings ?
* that would anchor one column in place while allowing
the other columns to be moved ?

If you use a virtual grid (wx.GridTableBase) you can maintain a mapping
between your actual data columns and the order in which they are displayed,
and can then manipulate the mapping as required.

I know that this is not what you are asking for, but if nobody comes up with
a better idea, it is fairly easy to implement. Feel free to come back with
more questions.

HTH

Frank Millman

Barak, Ron wrote:

Hi Guys,

Do you know of an extension to wxGrid -

    * that will allow rearranging the grid's columns as well as the
      columns' headings ?
    * that would anchor one column in place while allowing the other
      columns to be moved ?

[shameless plug follows]

Dabo's dGrid exposes separate dColumn objects in a nice interface, like:

class MyGrid(dabo.ui.dGrid):
   def initProperties(self):
     self.ResizableColumns = True
     self.MovableColumns = True

   def afterInit(self):
     self.addColumn(dabo.ui.dColumn(self, Caption="Col 1",
                    Resizable=False))
     self.addColumn(dabo.ui.dColumn(self, Caption="Col 2",
                    Resizable=True))

So as written above, by default the grid will allow resizing and moving the columns, but that behavior can be overridden on a column-by-column basis. I see that we never gave dColumn a Movable property, which I'm adding a Trac ticket for right now.

In addition, there are lots of nice properties like:

dColumn.HeaderBackColor : back color of the header
dColumn.BackColor : default back color of the cells in the column

As far as I know, there really isn't an easy way to paint on an individual column header in wx.Grid as you have to figure out a lot of things yourself as the header region is one window encompassing all columns. Dabo's abstracted that away into the nice column api.

You can use dabo's dGrid intermixed with raw wxPython objects, although it really is intended to be used as part of the Dabo framework, which is database-app-centric. You'll have to learn at least some of the Dabo Way to get your grid working as desired.

See: http://dabodev.com

Paul

Barak, Ron wrote:

Hi Guys,

Do you know of an extension to wxGrid -

    * that will allow rearranging the grid's columns as well as the
      columns' headings ?

See wx.lib.gridmovers

···

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

Hi Robin,

I tried to look at wx.lib.gridmovers on http://wxpython.org/docs/api/wx.lib.gridmovers-module.html, but the documentation seems to be comprised only of placeholders, e.g.:

Home
Trees
Index
Help
wxPython 2.8.9.1

Package wx :: Package lib :: Module gridmovers :: Class ColDragWindow
[frames | no frames]

Type ColDragWindow

[object](http://wxpython.org/docs/api/__builtin__.object-class.html) --+ | [Object](http://wxpython.org/docs/api/wx.Object-class.html) --+ | [EvtHandler](http://wxpython.org/docs/api/wx.EvtHandler-class.html) --+ | [Window](http://wxpython.org/docs/api/wx.Window-class.html) --+
>
**ColDragWindow**
···

Method Summary

__init__(self, parent, image, dragCol)

DisplayAt(self, pos , y)

GetInsertionColumn(self)

GetInsertionPos(self)

GetMoveColumn(self)

OnPaint(self, evt)

Property Summary

Home
Trees
Index
Help
wxPython 2.8.9.1

  Generated by Epydoc 2.1.20050511.rpd on Sun Sep 28 15:08:54 2008

http://epydoc.sf.net


Serching your wxPython in Action book also did not produce any help.

Can an example or other documentation for wx.lib.gridmovers be found elsewhere ?

Bye,
Ron.

-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Friday, December 05, 2008 04:02
To: wxpython-users@lists.wxwidgets.org
Subject: Re: [wxpython-users] wxGrid’s extension that allows rearranging grid’s columns + headings ?

Barak, Ron wrote:

Hi Guys,

Do you know of an extension to wxGrid -

* that will allow rearranging the grid's columns as well as the
  columns' headings ?

See wx.lib.gridmovers


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

Barak, Ron wrote:

Can an example or other documentation for wx.lib.gridmovers be found elsewhere ?

Look at GridDraggable.py in the demo folder.

···

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