Re: CellRendererCombo example



On Tue, 2006-11-21 at 13:53 +0100, Bo Lorentsen wrote:
> Murray Cumming wrote:
> >> Do anyone have a simple example of how this can be done in gtkmm, so I 
> >> can watch and learn ?
> > 
> > It's probably not mentioned in the book yet (it should be), but there is
> > an example:
> > 
> > http://cvs.gnome.org/viewcvs/gtkmm/examples/book/treeview/combo_renderer/
> Thanks, this was most helpful ... now it works.
> 
> So a combo column can only contain a string,

Yes, and you can tell the CellRendererCombo what column is the string
column by setting the text_column property:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1CellRendererCombo.html#10487df4cbf1d571653984fdfa777ede

However, I think, when you select an item from the CellRendererCombo, it
will try to convert the text to the type of the column that it is
rendering, such as an integer. 

>  and I was only able to make 
> it render the content of the first field in the combo list model.

To have multiple "columns" of data in the CellRenderCombo's drop-down
list, you have to do some extra magic in the editing_started signal
handler, so you can use pack_start() to add another CellRenderer into
the underlying ComboBox.

Unfortunately, I think you have to do this via a C signal handler, as I
do here:
http://cvs.gnome.org/viewcvs/glom/glom/utility_widgets/cellrendererlist.cc?view=markup
 
-- 
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]