[Seaside] Using popupAnchor ?
mbany at cincom.com
Tue Jan 30 17:02:18 UTC 2007
> I'm writing a component that displays a collectionof
> pictures. The idea is to have a miniature acting as a link to
> a larger version of the image, and to have a download link
> below the miniature.
> I tried to use the #popupAnchor, but I don't understand how
> to use it.
> My idea was to write something like this:
> MyComponent>>renderContentOn: html
> html popupAnchor
> callback: [:r | self renderBigPictureOn: r];
> with: [html renderMiniature: item on: html].
> MyComponent>>renderBigPictureOn: html
> html image src: 'thesource' .... .
> html anchor
> callback: [self session closePopupWithoutReloadingOpener];
> with: 'close link'.
> But it doesn't work (I get errors when #with: get called in
> Does someone have a sample usage of popupAnchor ? Many thanks!
1) You have rendering code in the callback, this does not make
any sense in Seaside and is very common mistake.
2) You need to supply a name for the popup window to avoid the walkback.
I would try this.
bigPictureRequested := false.
[bigPictureRequested := false.
^self renderBigPictureOn: html].
callback: [bigPictureRequested := true];
extent: 400 at 400; "Size of the picture"
with: [html renderMiniature: item on: html].
html image src: 'thesource' .... .
callback: [self session closePopupWithoutReloadingOpener];
with: 'close link'.
More information about the Seaside