adding elements to other elements (images within links, for example)

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

adding elements to other elements (images within links, for example)

Chris Dawson
I'm confused why this code does not work.  Should not add:'ing the WebImage to the WebLink enclose the link around it?  And, then adding the WebLink object to the div enclose it all within the div?

    self observee photos withIndexDo: [ :ea :index | 
       
        | link img photoDiv |

        link := WebLink new.
        link onClick: ( 'toggleHighlight(', ( ea id asString ), ')' ).
        img := WebImage new.
        img src: ( ea path ).
        img size: 120@90; border: 0.   
        link add: img.
        photoDiv := WebElement newDiv.
        photoDiv class: 'vivohphoto'.   
        photoDiv add: link.
        e add: photoDiv.   
        ( index \\ 4 = 0 )  ifTrue: [ photoDiv addBreak ].
     ].   

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: adding elements to other elements (images within links, for example)

Janko Mivšek
Hi Chris,

I also don't see the problem, except that onClick event handler should
be done on image, not link, IMO.

See also methods in category WebElement adding links (image) for more clues.

Best regards
Janko

Chris Dawson wrote:

> I'm confused why this code does not work.  Should not add:'ing the
> WebImage to the WebLink enclose the link around it?  And, then adding
> the WebLink object to the div enclose it all within the div?
>
>     self observee photos withIndexDo: [ :ea :index |
>        
>         | link img photoDiv |
>
>         link := WebLink new.
>         link onClick: ( 'toggleHighlight(', ( ea id asString ), ')' ).
>         img := WebImage new.
>         img src: ( ea path ).
>         img size: 120@90; border: 0.  
>         link add: img.
>         photoDiv := WebElement newDiv.
>         photoDiv class: 'vivohphoto'.  
>         photoDiv add: link.
>         e add: photoDiv.  
>         ( index \\ 4 = 0 )  ifTrue: [ photoDiv addBreak ].
>      ].  
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida