Re: Changing color of individual cells in a table



OK, let me simplify and rephrase my question.  Say I would like to have a
2x2 table with each cell colored differently and containing a short string
of text.  Anybody could explain how to achieve this behavior?

What would be the appropriate ModelColumns class to use and what would be
the appropriate TreeModel/TreeView structure?

I think, I don't really get the conceptual side of this.  Things should
become much simpler once I do.  I hope someone will help me with this, as I
don't have anybody else to ask.


Thanks much,

Nickolai Dobrynin



On Thu, Jun 30, 2005 at 03:11:52PM -0500, Nickolai Dobrynin wrote:
> Hi...
> 
> I know this was discussed before, but somehow that didn't help me much, so here I am.  :)
> Is there any way I could change the background color of an individual cell if I use the
> following model in combination with ListStore:
> 
>   class ModelColumns : public Gtk::TreeModel::ColumnRecord {
>   public:
>     ModelColumns();
> 
>     Gtk::TreeModelColumn<Glib::ustring> m_1stColumn;
>     Gtk::TreeModelColumn<Glib::ustring> m_2ndColumn;
>     Gtk::TreeModelColumn<Glib::ustring> m_3rdColumn;
>     Gtk::TreeModelColumn<Glib::ustring> m_4thColumn;
>   };
> 
>   ModelColumns m_Columns;
> and then 
>    m_refTreeModel = Gtk::ListStore::create(m_Columns);
>    m_TreeView.set_model(m_refTreeModel);
>    ...................................................
>    m_TreeView.append_column("", m_Columns.m_1stColumn);
>    m_TreeView.append_column("", m_Columns.m_2ndColumn);
>    m_TreeView.append_column("", m_Columns.m_3rdColumn);
>    m_TreeView.append_column("", m_Columns.m_4thColumn);
> 
> (This should display a fixed-size table of strings).
> 
> Yes, I've seen this link: http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch08s02.html#id2880753
> but I'm still not sure if this applies to my case.  Can someone please help me out?
> 
> 
> Many thanks to each and all,
> 
> Nickolai Dobrynin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]