[Seaside] [Q] Rendering and components...
Brian Brown
brian at teuton.org
Tue Apr 1 01:20:18 CEST 2003
Quoting Avi Bryant <avi at beta4.com>:
>
> 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:?
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
>
> 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.
>
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?
> The MenuBar might in turn pass this on to its items:
>
> items add:
> (MenuItem
> target: target
> selector: #doStuff
> description: 'Do Some Stuff')
>
Yeah, this is pretty close...
> 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?
>
Very, except mine doesn't work ;-)
> Avi
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside
>
--
More information about the Seaside
mailing list