1

I'm writing a program using gtkmm-2.4 GUI package in Linux. How can I set a text column of a TreeView object to perform word wrapping in C++?

gpoo
  • 8,408
  • 3
  • 38
  • 53
Rasoul
  • 3,758
  • 5
  • 26
  • 34

1 Answers1

3

Ahh, the strange and delightful word of GTK's CellRenderers.

#include <pangomm/layout.h>

// say we want to wrap the 3rd column in our treeview
int colNum = 3;
Gtk::CellRendererText* pCellRendererText = dynamic_cast<Gtk::CellRendererText*>(pTreeView->get_column_cell_renderer(colNum));
pCellRendererText->property_wrap_mode() = Pango::WRAP_WORD;
pCellRendererText->property_wrap_width() = 20;
gpoo
  • 8,408
  • 3
  • 38
  • 53
Mark
  • 106,305
  • 20
  • 172
  • 230
  • Thanks a lot! I was reading the reference doc to figure out how to do that for a few hours... – Rasoul Jan 15 '13 at 19:37