Drawing grid labels

Is there any way that I can draw the column labels in wxGrid
myself? I want to include a sort indicator.

The only thing I can think of is to remove the labels and
have a custom renderer for the first row of data which is
the actual labels, which feels wrong.

Roger

Roger Binns wrote:

Is there any way that I can draw the column labels in wxGrid
myself? I want to include a sort indicator.

The only thing I can think of is to remove the labels and
have a custom renderer for the first row of data which is
the actual labels, which feels wrong.

You could catch the EVT_PAINT event from the grid.GetGridColLabelWindow()

···

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

Roger Binns wrote:
> Is there any way that I can draw the column labels in
> wxGrid myself? I want to include a sort indicator.

Robin Dunn writes:

You could catch the EVT_PAINT event from the
grid.GetGridColLabelWindow()

Thanks Robin, for pointing out GetGridColLabelWindow().
As far as I can tell, that function doesn't appear in the
docs at all.

I have been designing a custom grid for browsing
datasets, incremental searching, sorting, etc. and one
thing I wanted was graphical arrows in the headers to
denote ascending/descending sorting. I had moved on,
though, content for the moment with the ^ and _ chars
to denote sorting.

However, because of this thread, I spent a little while
last night getting the graphical headers working. I just
draw a simple triangle, pointed up or pointed down, in
the upper-left corner of the appropriate column.

If anyone is interested in seeing a sample, I've prepared
one here:

http://www.paulmcnett.com/py/drawingOnGridColumnHeader.py

Every thing I figure out to do, the more I feel at home
with wxPython!

···

--
Paul

Paul McNett writes:

If anyone is interested in seeing a sample, I've prepared
one here:

http://www.paulmcnett.com/py/drawingOnGridColumnHeader.py

Sorry!

http://www.paulmcnett.com/py/drawingOnGridColumnLabel.py

···

--
Paul