Using popupAnchor ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using popupAnchor ?

Vincent Girard-Reydet
Hello,

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!


Vincent

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Using popupAnchor ?

Bany, Michel
 

> 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@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.


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside