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

Avi Bryant avi at beta4.com
Mon Mar 31 23:56:34 CEST 2003


On Mon, 31 Mar 2003, Brian Brown wrote:

> One of the components is called MenuBar and MenuBar contains an ordered
> collection of MenuItems...(which in their most basic form are
> anchorWithAction:text: sends).
>
> So far the MainPage renders correctly and the ManuBar component also renders the
> links just like I want. When I click on the links, I get MNU.. because I am not
> correctly referencing the WAComponent that is telling the menubar to render.
>
> Is this related to Callbacks, as in I should register one? Or is there a
> variable I can reference that will give me my MainPage component (the entrypoint
> for the application)?

It's hard without seeing any code snippets to know exactly what you're
getting at.  What is the block that you're passing in to
#anchorWithAction:text:?

The general pattern I use with navigation components like that is to pass
them in a 'target'.  So, if the actions of the menu items are affecting
the MainPage, when you create your MenuBar you would pass in that
component:

bar := MenuBar new target: mainPage.

The MenuBar might in turn pass this on to its items:

items add:
  (MenuItem
     target: target
     selector: #doStuff
     description: 'Do Some Stuff')

Rendering the menu item might then look like this:

MenuItem>>renderContentOn: html
  ...
  html anchorWithAction: [target perform: selector] text: description.
  ...

How closely does that match what you're doing?

Avi



More information about the Seaside mailing list