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 |
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 > > 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 |
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 > > 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 |
Hi Elod, have you considered the Smalltalk dependency mechanism, the
more general Listener pattern or even Notifications? Good luck.. > 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 > > > |
No, because I haven't got the slightest idea how those things work.
Maybe somebody could help me :-) Elod >Hi Elod, have you considered the Smalltalk dependency mechanism, the >more general Listener pattern or even Notifications? > >Good luck.. > > > >>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 >> >> >> >> >> > > > > > |
Free forum by Nabble | Edit this page |