1

Im looking forward to expand one of my gtkmm treeview columns so it would use all the space left, and shrink other columns... Its there any way to do this?

m_ScrolledWindow.add(m_TreeView);
m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);


m_refTreeModel = Gtk::ListStore::create(m_Columns);
m_TreeView.set_model(m_refTreeModel);

m_TreeView.append_column("ID", m_Columns.m_col_id);
m_TreeView.append_column("Task", m_Columns.m_col_task);
/// I WANT TO EXPAND TASK COLUMN
m_TreeView.append_column("Time", m_Columns.m_col_time);
m_TreeView.append_column("Date", m_Columns.m_col_date);
gpoo
  • 8,408
  • 3
  • 38
  • 53
JuanCB
  • 305
  • 1
  • 3
  • 11

1 Answers1

1

Yes

EDIT: I was wrong, see correct way below (works in my code)

You would need to do this:

m_TreeView.get_column(1)->set_expand(true);

(replace '1' with actual position counting from 0 and left to right)

Note: This just makes column 'n' take up all free space. It won't hide any other columns.

Christian Smith
  • 605
  • 3
  • 11
  • Im getting errors when building... /usr/include/gtkmm-2.4/gtkmm/treeviewcolumn.h:121:19: error: ‘Gtk::TreeViewColumn& Gtk::TreeViewColumn::operator=(const Gtk::TreeViewColumn&)’ is private /home/juanchi/MeTaskManager/src/gui.cpp:38:34: error: within this context – JuanCB May 17 '12 at 03:48
  • Try `m_TreeView.set_expander_column(*(m_TreeView.get_column(n));` (Where 'n' is the column number from 0) – Christian Smith May 20 '12 at 15:24