<div dir="ltr">Hi Arnd.<div><br></div><div>Sorry for the late response.</div><div><br></div><div>It worked. :)</div><div><br></div><div>Thank you very much.</div><div><br></div><div>João</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-08-22 12:59 GMT+01:00 Arnd Wippermann <span dir="ltr"><<a href="mailto:arnd.wippermann@web.de" target="_blank">arnd.wippermann@web.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>



<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">have you registered your event?</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">something like that, should do the job:</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">xgis.map.prototype.initialize = function(name) 
{<br>    ...<br>    ...</font></span></div>
<div> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">    this.events = new 
OpenLayers.Events(this,<br>                                        
null,<br>                                        
['groupadded'],<br>                                        
false,<br>                                        
{includeXY: true});</font></span></div>
<div> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">    this.events.register("groupadded", this, 
function (e) {<br>        alert("group layer 
added");<br>    });<br>    
<br>};</font></span></div><span class="">
<div> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">xgis.map.prototype.addGroup = function(name) 
{<br>    /* CODE FOR ADDING A GROUP */<br>    /* 
Trigger when group is added */<br>    
this.events.triggerEvent('groupadded', group);<br>};<br></font></span></div>
</span><div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">Regards,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">Arnd</font></span></div><br>
<div dir="ltr" lang="de" align="left">
<hr>
<font face="Tahoma"><b>Von:</b> <a href="mailto:openlayers-users-bounces@lists.osgeo.org" target="_blank">openlayers-users-bounces@lists.osgeo.org</a> 
[mailto:<a href="mailto:openlayers-users-bounces@lists.osgeo.org" target="_blank">openlayers-users-bounces@lists.osgeo.org</a>] <b>Im Auftrag von </b>João 
Rodrigues<br><b>Gesendet:</b> Donnerstag, 21. August 2014 12:14<br><b>An:</b> 
<a href="mailto:openlayers-users@lists.osgeo.org" target="_blank">openlayers-users@lists.osgeo.org</a><br><b>Betreff:</b> [OpenLayers-Users] How to 
add custom events to OpenLayers-based API?<br></font><br></div><div><div class="h5">
<div></div>
<div dir="ltr">
<div>Hi</div>
<div><br></div>
<div>I am woking on a GIS API built on top of OpenLayers. I have a class called 
xgis.group, which represent a group of layers.</div>
<div>I want to add an event that can be triggered when a group is added.</div>
<div><br></div>
<div>For example, in the map, I have tried this without success:</div>
<div><br></div>
<blockquote style="BORDER-LEFT:rgb(204,204,204) 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote"><font color="#0000ff">    
  xgis.map.prototype.addGroup = function(name) {</font><font color="#0000ff"><br></font><font color="#0000ff">        /* 
  CODE FOR ADDING A GROUP */</font><font color="#0000ff"><br></font><font color="#0000ff">        /* Trigger when group is added 
  */<br></font><font color="#0000ff">        
  this.events.triggerEvent('groupadded', group);<br></font><font color="#0000ff">    };</font></blockquote>
<div><br></div>
<div>I don't know how to deal with custom-made events.</div>
<div><br></div>
<div>Could you lend me some help, please?</div>
<div><br></div>
<div>Thanks</div></div>
<br><br>
</div></div><hr style="border:none;color:#909090;background-color:#b0b0b0;min-height:1px;width:99%">
<table style="border-collapse:collapse;border:none">
        <tbody><tr>
                <td style="border:none;padding:0px 15px 0px 8px">
                        <a href="http://www.avast.com/" target="_blank">
                                <img border="0" src="http://static.avast.com/emails/avast-mail-stamp.png">
                        </a>
                </td>
                <td>
                        <p style="color:#3d4d5a;font-family:"Calibri","Verdana","Arial","Helvetica";font-size:12pt">
                                Diese E-Mail ist frei von Viren und Malware, denn der <a href="http://www.avast.com/" target="_blank">avast! Antivirus</a> Schutz ist aktiv.
                        </p>
                </td>
        </tr>
</tbody></table>
<br>
</div>
</blockquote></div><br></div>