[Seaside] [Q] Rendering and components...

Brian Brown rbb at techgame.net
Tue Apr 1 16:49:13 CEST 2003


On Tuesday 01 April 2003 12:28 am, Avi Bryant wrote:
> On Tue, 1 Apr 2003, Brian Brown wrote:
> > html anchorWithAction: [self mainContent: action.] text: displayName.
> >
> > Where mainContent: is a method on the calling component... so self
> > doesn't work; and both action and displayName are instance variables...
> > action being something like #InfoPage so the mainContent would set the
> > component it should render to InfoPage
>
> Right.  So if you were passing in the target as I described, this would
> stay the same except it would be "target mainContent: action" instead of
> self.
>

Ok, now when I create a MenuBar it's:
bar := MenuBar new target: self.  "From the MainPage component"
self menuBar: bar.

And in MenuItem (created from the MenuBar):
items := OrderedCollection new.
items add: (MenuItem new initialize: 'Home' with: HomePage target: target.)  
"target is an accessor for the instance variable that was initialized to the MainPage component"


> Why are you using a symbol (#InfoPage) instead of just referencing the
> class directly?
>
I thought that was how to create a Symbol to pass around... I got rid of the #.

> > > bar := MenuBar new target: mainPage.
> >
> > What would mainPage be in the above line? If my class is MainPage, then I
> > would want the target to be the instance for this session, right?
>
> Correct.  If you're creating the MenuBar from the MainPage, that'll
> just be self.

Yes, that's what I'm doing.
>
> Let me know if it still doesn't work for you.
>

This is the code that is in MenuItem>>renderContentOn:
renderContentOn: html
	html anchorWithAction: [target perform: #mainContent with: action.] text: displayName.
	html hr.

Now my traceback says that MNU mainContent  and shows self as nil:

---------------------------
MessageNotUnderstood: mainContent

UndefinedObject(Object)>>doesNotUnderstand:

self
nil


aMessage
a Message with selector: #mainContent and arguments: #(InfoPage)

[] in MenuItem>>renderContentOn:

self
a MenuItem


html
a WAHtmlRenderer
[snipped for brevity]
----------------------------------------
> Avi
>
>
Brian


More information about the Seaside mailing list