lua-users home
lua-l archive

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


On Sat, 15 Dec 2012 17:53:01 -0500, Rena wrote:

> I can't seem to find anywhere how to provide a cell data function[1]
> to a GtkTreeViewColumn using lgi. I'm doing:
> 
> gtk.TreeViewColumn { title = "Val", {
> 	gtk.CellRendererText { font = "monospace" },
> 	{ text = reg_column.Value, data_func = function(...)
> 		print("render", ...)
> 		return "x"
> 	  end },
> }},

The problem is that you are passing data_func as part of column/attribute 
definition, while it is expected as cellrenderer definition table.  This 
works for me (slightly reformatted to see the table hierarchy more 
clearly):

gtk.TreeViewColumn {
    title = "Val", {
        gtk.CellRendererText { font = "monospace" },
	{ text = reg_column.Value },
        data_func = function(...)
            print("render", ...)
            return "x"
	end
    },
}

It seems to be missing in the docs, I'll try to add it when I get to it.

hth,
Pavel