Re: Using a TreeStore with a ComboBox



Milosz Derezynski wrote:
On 6/23/07, Jonathon Jongsma <jonathon jongsma gmail com> wrote:
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...

Well there isn't, except for what we originally proposed just on the
combobox model: use a  TreeModelFilter, which filters out all rows not meant
to be selected... guess that's the best it can get..

I'll try to explain again what I'm trying to do. I made a screenshot [1] to illustrate the problem this time.

As you can see in the screenshot, there is a toplevel node "Noordzee" (Northsea) which contains some child nodes. The child nodes are real places (names of wrecks in this case) and the toplevel nodes are used to group related places together. But those toplevel nodes are not necessary real places. This is very similar to the concept of files and folders, where you can organize files into an arbitrary hierarchy of folders, but a folder is not a file.

In the dropdown menu of the combobox, each submenu contains not only the list of child nodes, but also the parent node (along with a separator). But since they are there only for grouping, it doesn't make sense to be able to select them. So I would like to remove them from the submenu only (along with the separator). If I remove them from the model, also the child nodes are gone and that's not what I want.

[1] http://users.telenet.be/sacn/tmp/combobox.png





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