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

Avi Bryant avi at beta4.com
Tue Apr 1 16:02:00 CEST 2003


On Tue, 1 Apr 2003, Brian Brown wrote:

> And in MenuItem (created from the MenuBar):
> items := OrderedCollection new.
> items add: (MenuItem new initialize: 'Home' with: HomePage target: target.)

> 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:

So, target must be nil, which means it isn't getting set correctly.  What
does your #initialize:with:target: method look like?  (By the way, it's
best to give more descriptive names that give some idea of what the
parameters are, eg,
#initializeWithDescription:componentClass:target:).

A couple of other points.  #mainContent and #mainContent: are two
completely different method names, one of which takes 0 parameters and the
other of which takes one.  So (target perform: #mainContent with: action)
doesn't make any sense - you're trying to pass a parameter to a zero
argument method, and one which presumably doesn't exist.  You would use
(target perform: #mainContent: with:  action) except that there's no sense
in using #perform: when you know the method name already - you can just
send the message directly, eg, (target mainContent: action).  #perform: is
used when you don't know what the method is you're trying to call - I used
it in my example code because each MenuItem was calling a different method
on the target, but yours don't do that.

That make sense?

Cheers,
Avi




More information about the Seaside mailing list