Re: Switch a CellRendererCombo's model

On Jul 4, 2005, at 11:50 PM, Daniel Kasak wrote:

I'm having a really, *really* bad performance problem in a treeview that
has a CellRendererCombo with a large model.

How bad?

The combo should really only display options that are relevant to the
current row anyway.

What I'd like to do is to run some code that replaces the model in the
CellRendererCombo with a fresh one each time a new row is selected, or
when something else happens that would affect the list of options. I
assume I can do this with:

$renderer->set( model   => $new_model );

However this will have the undesired impact of leaving all the other
CellRendererCombos in other rows in the treeview with a model that
doesn't contain the item that they're currently displaying, ie all the
cells will be blank. Is that right?

Yes. When you set a cell renderer property with $renderer->set(), that value will be used for all rows in the column.

Is there any way around this?

Store the appropriate combo model for each row in an extra column in the main treemodel, and use an attribute on the TreeViewColumn to tell the CellRendererCombo where to find the model. Since this has potential to use obscene amounts of memory, you'll want to share models between rows.

I don't like... this game... when there's cannons... being shot... at me.
  -- Elysse

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