Re: [Fxruby-users] Treelist -- can't add new items with data.
Status: Inactive
Brought to you by:
lyle
From: Lyle J. <jl...@cf...> - 2003-08-15 21:16:25
|
Hugh Sasse Staff Elec Eng wrote: > I have just had some interesting results. I was explaining to > someone that I have spent ages trying to do this, and, look, doesn't > work, and when I double click on the treelist nothing happens, BUT > IT DID! I now find that my items are being added to the treeItem > but the item is not actually opened/expanded. I should have thought of that. Oh well, glad to hear that it's working. > OK, I can work with this. What is the semantic difference between > opening and expanding in tree lists? At the moment when I want to > open I open and expand, and conversely collapse and close together. > What is the right thing to do for these? I think that what you are doing is the right thing to do, for your application. When you programmatically open or close an item (i.e. by calling the openItem() or closeItem() methods) it only changes that item's state from "opened" to "closed", or vice-versa. If that tree item has different icons for the open and closed state, such as an opened and closed file folder, this will be the only visible cue of the change. There are some situations where it is useful to make this distinction (of opened versus closed); I'll describe one of them in a few paragraphs. But for your application, this may not be a useful distinction. In that, you may want to just use the same icon for both the opened and closed state and ignore that issue altogether (i.e. just worry about expanding or collapsing the subtrees at the appropriate times). Expanding and collapsing parts of the tree is a separate action and is independent of the "root" item's opened or closed state. That is, you can expand the subtree under an item without actually "opening" it. I'm not sure I can give you a precise description of the /semantics/ of open/close versus expand/collapse. This feature of the tree list was specifically added for developing Windows Explorer-like widgets, where there's a tree list on the left and a different view of the current item's contents on the right. So, if the user clicks *once* on a directory folder in the tree list (e.g. "My Documents"), that tree item is *opened*, and that folder's contents are shown in the right-hand pane; but the tree item is not *expanded* unless the user double-clicks on it. Hope this helps, Lyle |