Re: [gtkmm] add a button into a TreeModel of Treeview ???



The aim of putting a button in a model , for me, is to make it possible to add small buttons for deleting, modifying, or activate a line for example ...

Thank you for your help, i will try the customcellrenderer example !  :o)

Murray Cumming a écrit :

On Tue, 2004-06-22 at 18:50 +0100, Roger Leigh wrote:
cedric <cedric probesys com> writes:

i ve a problem with a Gtk::TreeModel::ColumnRecord: i want to put a
button in it, but i don t manage to do it! :'(
From my understanding of the TreeView, you would need to provide a new
CellRenderer, CellRendererButton, which would render a button for you.

A button is not data, so it's silly to put it in the model or to try to
render it.

This does need a custom cellrenderer, but I don't think it needs to be
connected to anything in the model. There is a customcellrenderer
example.

It would implement properties such as property_label and
property_clicked_slot as a label and slot to call when clicked.  You
would then put the label and slot into the TreeModel, and tie them to
the properties with Gtk::TreeViewColumn::add_attribute().

Point of interest: can the slots be copied by value and stored in the
TreeModel?


Regards,
Roger





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