Re: Using a TreeStore with a ComboBox



On 6/23/07, Jef Driesen <jefdriesen hotmail com> wrote:
Milosz Derezynski wrote:
> Well, if it's really *just* that:
>
> On 6/23/07, Jef Driesen <jefdriesen hotmail com
> <mailto:jefdriesen hotmail com>> wrote:
>
>     After refilter, the combobox contains no items anymore, just like when I
>     populate the model before using set_visible_func. This is what I
>     expected, because in my model all toplevel nodes have children. Of
>     course this is not the solution I need.
>
>
> and the grander scheme isn't something bigger, then you can just alter
> the function to:
>
> bool
> Example::on_model_visible (const Gtk:TreeModel::const_iterator& iter)
> {
>   return (iter != store->children().begin && iter->children().empty());
> }

This doesn't make any difference. This change only affects the very
first node, which also has children in my example model, and thus
doesn't change anything.

I think a TreeModelFilter is not the solution for my problem, because it
  can only hide nodes from the main model. What I need is the
possibility to prevent certain nodes from being selected in the
combobox. That is a change in the presentation of the model, not the
model itself (e.g. something similar to the set_select_func from the
treemodel).

So you want to display all nodes, but only allow the user to select
some of them?  I'm not sure how to accomplish this with a combobox.
Andrew's original suggestion would have worked with a TreeView, but I
don't know of anything similar for a combobox...

--
jonner



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