Autowrap in wxGrid

Is it possible that the content of a grid cell automatically wraps
around on a new line if the grid cell is not wide enough to hold the
value? Now the text simply flows over to the next cell on the right.

I read about similar request dated 2001 and wonders if such feature is
already present in wx.Grid since then.

···

--
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn

Yuan HOng wrote:

Is it possible that the content of a grid cell automatically wraps
around on a new line if the grid cell is not wide enough to hold the
value? Now the text simply flows over to the next cell on the right.

I read about similar request dated 2001 and wonders if such feature is
already present in wx.Grid since then.

You can use the wx.grid.GridCellAutoWrapStringRenderer to change how the
cells are rendered.

···

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

Tried this renderer. It is breaking English texts well, but not the
Chinese text. Since the Chinese words are not separated by space,
the renderer treats a long Chinese sentence as one word and does not
break it.

The wx.TextCtrl handels the Chinese text correctly. Is it possible to
make wx.grid.GridCellAutoWrapStringRenderer behave like the text
control as far as wrapping is concerned?

···

--
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn

Yuan HOng wrote:

Tried this renderer. It is breaking English texts well, but not the
Chinese text. Since the Chinese words are not separated by space,
the renderer treats a long Chinese sentence as one word and does not
break it.

The wx.TextCtrl handels the Chinese text correctly. Is it possible to
make wx.grid.GridCellAutoWrapStringRenderer behave like the text
control as far as wrapping is concerned?

It's just a custom class that does a dc.DrawText after processing the
string. It's not very sophisticated and so it is just looking for the
spaces on how to split the string. It's not too har to write a Renderer
and so I would suggest that you do one that is aware of the line
wrapping rules for Chinese text and use that instead of the
wx.grid.GridCellAutoWrapStringRenderer class.

···

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