Hi, If you want to provide a completely executable example, you could use Gofer. In your case, it would look as in the script below. This could be used in a fresh Moose image: Gofer new smalltalkhubUser: 'Offray' project: 'Ubakye'; package: 'Ubakye'; load. mainTree := UbakyeNode new. mainTree becomeDefaultTree. browser := GLMTabulator new. browser column: #preview. browser act: [:newNode | newNode := UbakyeNode header: 'nuevoNodo' body: ''. mainTree addNode: newNode.] icon: GLMUIThemeExtraIcons glamorousAdd entitled: 'Add an item in the collection'. browser act: [:b | b entity removeLast. b update ] icon: GLMUIThemeExtraIcons glamorousRemove entitled: 'Remove last item from the collection'. browser updateOn: GLMItemAdded from: #yourself; updateOn: GLMItemRemoved from: #yourself. (browser transmit) to: #preview; andShow: [ :a | a tree title: mainTree header; children: [:eachNode | eachNode children ]; format: [:eachNode | eachNode header ]. a text title: 'Text']. browser openOn: mainTree. Doru On Wed, Aug 13, 2014 at 9:37 PM, Offray Vladimir Luna Cárdenas < offray@riseup.net> wrote:
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
-- www.tudorgirba.com "Every thing has its own flow"