[Seaside] Using popupAnchor ?

Bany, Michel 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 
> #renderContentOn:).
> 
> 
> Does someone have a sample usage of popupAnchor ? Many thanks!

Two things.
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.

MyComponent>>initialize
bigPictureRequested := false.


MyComponent>>renderContentOn: html
bigPictureRequested ifTrue:
	[bigPictureRequested := false.
	^self renderBigPictureOn: html].
.....
html popupAnchor
     callback: [bigPictureRequested := true];
     name: 'big_pic';
     extent: 400 at 400; "Size of the picture"
     with: [html renderMiniature: item on: html].
....
 
MyComponent>>renderBigPictureOn: html
html image src: 'thesource' .... .
html anchor
    callback: [self session closePopupWithoutReloadingOpener];
    with: 'close link'.

HTH
Michel.




More information about the Seaside mailing list