Updating a hierarchical list...
Elod Kironsky
kironsky at grisoft.cz
Thu Apr 6 09:20:43 UTC 2006
Alain Plantec wrote:
> 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
>
>
Yes, that is clear to me. The problem is, that the objects inside the
list have no reference to the model (AbstractHierarchicalList), so they
cannot send changed: #getList. Is there a way, that i just fire and
event or message into the "Squeak world" and every object just gets it
and can react if it wants to?
Elod
More information about the Squeak-dev
mailing list
|