Hi Usman, On 08/13/2014 02:16 AM, Usman Bhatti wrote:
Hi Offray,
As Doru mentioned, without a complete example it is difficult to reproduce and analyze your problem.
My main issue is that I don't know how to share a complete example except by sharing this url: http://smalltalkhub.com/#!/~Offray/Ubakye/ and advising to upload the code and run "UbakyeBrowser open". In file based frameworks I can point to a specific file which contains the model of my defined objects, but I don't know how to share my own defined objects/messages in Smalltalk except by this or by manually cutting and pasting to email (it should be a better way). Anyway this is the part where I define a UbakyeNode: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Object subclass: #UbakyeNode instanceVariableNames: 'header headers key icon body children parent node' classVariableNames: '' category: 'Ubakye-Model' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- and the children method is the one which uses a colection: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- UbakyeNode>>children "Returns the receivers list of children" ^ children ifNil: [children := OrderedCollection new] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
For the tree to get updated on node addition or removal, you need to use GLMAnnouncingCollection to group your nodes. Hence, when you add a new node in your announcing collection object, this code comes into effect:
updateOn: GLMItemAdded from: #yourself;
So, make sure you are using appropriate collection object.
I tried changing OrderedCollection in the children message by GLMAnnouncingCollection, but the header message started to fail. Can I pass my children collection to a GLMAnnouncingCollection just in the interface or need I to change the object definition for the UbakyeNode, and if this is the case, how can I access the header of a UbakyeNode stored in this kind of collection? I know is kind of dumb to ask without proper context, but I hope that the SmalltalkHub repository (or other method) can be used to share my own defined object to make better questions.
usman
Cheers, Offray