stylish text in grid

Hello,

I need to have a stylable text control in the grid. I have to paint
diverse text in the cell with diverse background colors. That goes
also for display and edit modes.

My question is that can I somehow let the wxTextCtrl draw itself in a
wxGridCellRenderer for a cell or do I have to re-code the
functionality in a custom cell renderer.

···

--
Best regards,
Groszer Adam
--
Quote of the day:
Advice is what we ask for when we already know the answer but wish we didn't.
- Erica Jong

Adam Groszer wrote:

Hello,

I need to have a stylable text control in the grid. I have to paint
diverse text in the cell with diverse background colors. That goes
also for display and edit modes.

My question is that can I somehow let the wxTextCtrl draw itself in a
wxGridCellRenderer for a cell or do I have to re-code the
functionality in a custom cell renderer.

You'll need a custom cell renderer class.

···

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

Hello Robin,

What is the lifecycle of the custom renderer object?
Does it get instanciated and GC'ed with the grid or with every cell?

Sunday, October 29, 2006, 1:55:35 AM, you wrote:

···

Adam Groszer wrote:

Hello,

I need to have a stylable text control in the grid. I have to paint
diverse text in the cell with diverse background colors. That goes
also for display and edit modes.

My question is that can I somehow let the wxTextCtrl draw itself in a
wxGridCellRenderer for a cell or do I have to re-code the
functionality in a custom cell renderer.

You'll need a custom cell renderer class.

--
Best regards,
Adam mailto:adamg@fw.hu
--
Quote of the day:
Every journalist has a novel in him, which is an excellent place for it.

Adam Groszer wrote:

Hello Robin,

What is the lifecycle of the custom renderer object?
Does it get instanciated and GC'ed with the grid or with every cell?

It varies. It can be an instance per cell, per row, per col, or for the whole grid. The Renderer object (and the Editor too) is assigned to a cell attribute instance, so it depends on if you are setting the attributes for cell, row, col, or default.

···

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