Updating a hierarchical list...
Alain Plantec
alain.plantec at univ-brest.fr
Wed Apr 5 20:27:04 UTC 2006
Elod Kironsky a écrit :
> Hi!
>
> I am developing a hierarchical browser of hetergoenous objects (e.g.
> objects of different classes). I am using an AbstractHiererachicalList
> with a SimpleHierarchicalListMorph. The problem is, that if I add a
> new item into the list, it does not update itself and I must manually
> toggle the tree of the list to see the new item. I found out, that
> calling self list: (self model getList) perfectly updates the whole
> list and keeps the expanded trees expanded. The problem is, that the
> objects inside the list have no reference to the list itself so I
> cannot use the above call. Can anyone help? Is there a default
> mechanism to solve this problem, or it has to be implemented by an
> EventHandler?
>
> Thanks in advance,
>
> Elod
>
>
Hi Elod,
AbstractHierarchicalList is the model. It should have a method to build
the tree and send it to its SimpleHierarchicalListMorph.
Usually #getList is used and then if you want to refresh the list you
simply have to send "changed: #getList" to the model.
see #update: method in SimpleHierarchicalListMorph:
update: aSymbol
aSymbol == getSelectionSelector
ifTrue: [self selection: self getCurrentSelectionItem.
^ self].
aSymbol == getListSelector
ifTrue: [self list: self getList.
^ self].
((aSymbol isKindOf: Array)
and: [aSymbol notEmpty
and: [aSymbol first == #openPath]])
ifTrue: [^ (scroller submorphs
at: 1
ifAbsent: [^ self])
openPath: aSymbol allButFirst]
alain
More information about the Squeak-dev
mailing list
|