Search code examples
smalltalkpharoseaside

WACounter is displayed but doesn't increase/decrease


I'm new to smalltalk/pharo/seaside and i get trouble using a simple WACounter. I created a component and added this:

wa := WACounter new.
html render: wa.

The counter is displayed in my localhost but doesn't increase/decrease on click. It must be silly but i can't find what's happend. thanks


Solution

  • You should make the counter an instance variable, eg

    counter
        ^ counter
    

    and

    counter: aCounter
        counter := aCounter.
    

    then, your #children should answer this counter, too:

    children
        ^ Array with: self counter
    

    In your rendering method, then just render the counter:

    renderContentOn: html
    
        html render: self counter.