Re: Adding a CellRendererCombo to a SimpleList




On May 11, 2005, at 11:51 PM, Dan wrote:

So far I have:

    Gtk2::Ex::Simple::List->add_column_type(
                            "combo",
                            type        => "Glib::Scalar",
                            renderer    => "Gtk2::CellRendererCombo",
                            attr        => "text"
                           );

But the 'attr' value is wrong. What's more, I don't think there *is* an
attribute I can just 'set' like this, is there? So I need to add a sub
here to walk through the values in the model, testing each one as I go,
and set the correct iter when I get to it. Or am I missing some simpler
approach?

Not sure i follow in my groggy state. CellRendererCombo inherits from CellRendererText, so the text attribute is valid. It's also perfectly valid to use a subroutine for the attr (the manpage has an example).

SimpleList's column types are designed to map one column's value to one cellrenderer's property; if you need two for the CellRendererCombo, then, yes, you'll have to do something manual.

Note that it should be possible to use the SimpleList's TiedList class to tie a model, and use that model with your own view implementation. (The real attractive feature is the tied behavior, after all.)

--
I don't have a drinking problem,
'cept when i can't get drink.
  -- Tom Waits




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