RE: Comboxbox inside a TreeView



First, I've made an error. I'm using gtkmm-2.4.8 (and not 2.6)
And if I'm looking at examples (I've already done this before posting
my question), I could not find any such diirectory:

    examples/book/treeview/combo_renderer

Here The directory I have inside examples/book/treeview
    drag_and_drop
    editable_cells
    filter
    filter_modify
    list
    popup
    tree

Well, I've finally find an example about combobox but This example
was not compiling with gtkmm-2.4. It was written for gtkmm-2.0.
I've just to modify callback registration (SigC::bind -> sigc::mem_fun)
And it works fine.

For the pixbuf I've done the following. Tell me If I'm doing the right way
as I'm not using set_cell_data_func():

    1) declare the column model:
       class ModelColumns : public Gtk::TreeModel::ColumnRecord
       {
            public:
                ...
                Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbbuf> >  m_icon;
                ...
       };

    2) Declaring some pixbuf:
       Glib::RefPtr<Gdk::Pixbuf>    m_server_is_ok;
       Glib::RefPtr<Gdk::Pixbuf>    m_server_is_not_ok;
       Glib::RefPtr<Gdk::Pixbuf>    m_unknown_server_status;


    3) Creating the pixbuf:
       m_server_is_ok = Gdk::Pixbuf::create_from_file( FILE1 );
       m_server_is_not_ok = Gdk::Pixbuf::create_from_file( FILE2 );
       ...

    4) populate the list:
       Gtk::TreeModel::Row row = *(m_ref_tree_model->append());
       row[m_model_columns.m_icon] = m_unknown_server_status;

Is that ok ?
Thanks very much for the answer and for the future one :-)

Regards
Laurent Marzullo




-----Original Message-----
From: Murray Cumming [mailto:murrayc murrayc com]
Sent: Wednesday, February 02, 2005 1:14 PM
To: Laurent Marzullo
Cc: gtkmm-list
Subject: Re: Comboxbox inside a TreeView


On Mon, 2005-01-31 at 15:37 +0100, Laurent Marzullo wrote:
> Hello,
>
> I'm trying to find documentation explaining how to edit a cell inside
> a TreeView as a Combobox in gtkmm-2.6 ?
>
> Is there anyone who has already done this and could give me an example ?

There is an example already in examples/book/treeview/combo_renderer/

> I also want to add a pixbuf. I saw a CellRendererPixbuf but how may I use
it
> to display a boolean column (true = one pixbuf and false another pixbuf)?

You might use set_cell_data_func() .

--
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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