help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] seaside problem of understanding


From: Frank Church
Subject: Re: [Help-smalltalk] seaside problem of understanding
Date: Wed, 10 Jun 2009 17:55:50 +0100

2009/6/10 Joachim Jaeckel <address@hidden>:
> Hello,
>
> maybe one of you could do me a favor...?
>
> I try currently making friends with seaside. And bought the Tutorial book
> etc. But I have definetly a problem, running the example of the book.
>
> I first tried it in gst, and the most simple thing worked, than I came to
> step 2 (beginning of chapter 4) and from that point, gst is running wild, if
> I try to call the web-site of the tutorial app.
>
> After all, I tried it today with pharo, because the book is based on squeak
> and pharo should be very similiar. But even here, I have the same problem.
>
> Maybe one of you, who has a deeper knowledge of smalltalk and maybe seaside,
> could point me to the problem in my script. I don't find any mistake...
>
> Would be really great.
>
> The problem comes up, if I use in the STRootComponent the
> initializeMenuComponent method. If not, everything works. But I can't see
> any error in this.
>
> (If I use in the STRootComponent a line like "menuComponent: StMenuComponent
> new;" than everything is fine.
>
> Please see the script attached, I have currently no idea anymore.
>
> Regards,
> Joachim.
>
> Namespace current: STTutTodoApp [
>
>    Seaside.WAComponent subclass: StMenuComponent [
>        | entries |
>
>        entries [ ^entries ]
>        entries: someEntries [ entries := someEntries ]
>
>        initialize [
>            super initialize.
>            entries := OrderedCollection new.
>        ]
>
>        addEntry: aString withAction: aBlock [
>            self entries add: aString -> aBlock
>        ]
>
>        renderContentOn: html [
>            html anchor callback: []; with: 'Pre'.
>            html space.
>            html anchor callback: []; with: (entries size printString).
>            html space.
>
>        ]
>    ]
>
>    Seaside.WAComponent subclass: StListComponent [
>
>        renderContentOn: html [
>            html table: [
>                html
>                    tableRow: [ html tableData: [html text: 'Table entry' ]];
>                    tableRow: [ html tableData: [html text: 'Table entry' ]]
>            ]
>        ]
>    ]
>
>    Seaside.WAComponent subclass: STRootComponent [
>        | menuComponent listComponent |
>
>        STRootComponent class >> canBeRoot [
>            ^true
>        ]
>
>        menuComponent [ ^menuComponent ]
>        menuComponent: aMenu [ menuComponent := aMenu ]
>
>        listComponent [ ^listComponent ]
>        listComponent: aList [ listComponent := aList ]
>
>        initialize [
>            super initialize.
>            self
>                menuComponent: self initializeMenuComponent;
>                listComponent: StListComponent new.
>        ]
>
>        initializeMenuComponent [
>            | bla |
>            bla := StMenuComponent new.
>            bla addEntry: 'All1' withAction: [].
>            bla addEntry: 'All2' withAction: [].
>            self menuComponent: bla.
>        ]
>
>        children [
>            ^Array with: (self menuComponent) with: (self listComponent)
>        ]
>
>        renderContentOn: html [
>            "I render everything by calling html"
>
>            html heading: 'ToDo-List'.
>            html div
>                class: 'menu';
>                with: self menuComponent.
>            html div
>                class: 'list';
>                with: self listComponent.
>        ]
>    ]
>
> ]
>
> STTutTodoApp.STRootComponent registerAsApplication: 'STTutorial'
>
> _______________________________________________
> help-smalltalk mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-smalltalk
>
>

I am a Smalltalk newbie, but it looks like you are making a recursive call.

remove the 'self'' before initializeMenuComponent as
initializeMenuComponent references self already. Just my 2 cents.

>        initialize [
>            super initialize.
>            self
>                menuComponent: self initializeMenuComponent;
>                listComponent: StListComponent new.
>        ]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]