2011-10-03 56 views
1

我試過讓信息窗口標記內的點擊處理程序,但它不起作用。點擊事件永遠不會被調用。 我發現了一些Google-Maps API和JAVASCRIPT的解決方案,但是在GWT中我找不到。GWT clickHandler infoWindow marker

我嘗試了很多模式來添加點擊處理程序在一個標記的內部信息窗口,沒有人工作。

有人可以幫助我嗎?

class Curtindo implements ClickHandler{ 

    public void onClick(ClickEvent event) { 
     // EXAMPLE 
     Window.alert("Test"); 
    } 

} 

Curtindo click = new Curtindo(); 

final Button but_curtiu = new Button("",click); 
but_curtiu.setHTML("<div style='float:left; margin-left:5px'><img src='monografia/images/like.png' alt='Curtir'/>Curtir</div>"); 

//obj_geo is a marker 
obj_geo.addMarkerClickHandler(new MarkerClickHandler() { 
    public void onClick(MarkerClickEvent event) { 
     InfoWindow info = Monografia.map.getInfoWindow(); 
     info.open(obj_geo, new InfoWindowContent("" + 
       "<b>Nome: </b>"+aux[1]+"<br/>"+ 
       "<b>Descrição: </b>"+aux[2]+"<br/>"+ 
       "<div id=\""+aux[0]+"\">"+but_curtiu+"</div>"+panel));   
    } 
}); 

回答

1
com.google.gwt.user.client.ui.HTMLPanel htmlPanel= 
    new com.google.gwt.user.client.ui.HTMLPanel(("" + 
       "<b>Nome: </b>"+aux[1]+"<br/>"+ 
       "<b>Descrição: </b>"+aux[2]+"<br/>"+ 
       "<div id=\""+aux[0]+"\"></div>"+panel)); 

htmlPanel.add(but_curtiu, aux[0]); 
+0

添,按鈕會出現內部信息窗口,但你知道它可以捕捉到的事件?嘗試沒有成功button.addClickHandler和button.addDomHandler(處理程序,ClickEvent.getType())。 –

+0

我的問題已回答[此處](http://example.com) –

相關問題