Simply add the clickHandler in the for() after the creating of "div"..
something like these:

for(int i=0; i<4; i++){
> HTML div = new HTML("<a href=\""+numLink[i]+"\">Link"+(i+1)+"</a>");
> mainPanel.add(div);
> final int app = i+1;
>
> div.addClickHandler(new ClickHandler() {
>
> public void onClick(ClickEvent event) {
> Window.alert("Pressed "+ app);
> }
> });
> }





On Sat, Apr 5, 2014 at 4:50 PM, Matteo Fioravanti <theking...@gmail.com>wrote:

> Hi there, a function have this code to generate a list of event formatted
> with html and css.
>
> for (int i = 0; i < 10; i++) {
>  HTML div = new HTML ("<a href=\""+numLink[i]+"\">Link</a>");
>  RootPanel.get("mainLayout").add(div);
> }
>
>
> It 'a code for demonstration purposes, but my goal is to handle a
> clickhandler foreach link, I should also be good to change the tag with a
> div if necessary.
> In php+html this it was very clear for me, but in gwt i don't understand
> what i should i do.
>
> When I click the link I have to activate a feature that let me change the
> html code of the page, help me please!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-web-toolkit+unsubscr...@googlegroups.com.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> Visit this group at http://groups.google.com/group/google-web-toolkit.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to