<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18939"><!-- converted from rtf -->
<STYLE>.EmailQuote {
        BORDER-LEFT: #800000 2px solid; PADDING-LEFT: 4pt; MARGIN-LEFT: 1pt
}
</STYLE>
</HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px"
id=MailContainerBody leftMargin=0 topMargin=0 name="Compose message area"
CanvasTabStop="true">
<DIV><FONT color=#0000ff><FONT color=#000000><FONT face=Arial><FONT
size=2> <SPAN class=918154519-20092010><FONT color=#0000ff>Thanks for your
suggestion, I tried to use your suggested code but I am getting a Javascript
error after hovering over my layer, which states -
</FONT></SPAN></FONT></FONT></FONT></FONT></DIV><FONT color=#0000ff><FONT
color=#000000>
<DIV><BR><FONT size=2 face=Arial>Message: Unspecified error.<BR>Line:
1188<BR>Char: 1<BR>Code: 0<BR>URI: </FONT><A
href="http://localhost/WebServices/OpenLayers-2.10/OpenLayers.js"><FONT size=2
face=Arial>http://localhost/WebServices/OpenLayers-2.10/OpenLayers.js</FONT></A></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><SPAN class=918154519-20092010><FONT color=#0000ff size=2 face=Arial>which
is this line in OpenLayers.js but not sure exactly what's wrong. I do appreciate
your assistance.</FONT></SPAN></DIV>
<DIV><SPAN class=918154519-20092010><FONT color=#0000ff size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=918154519-20092010><FONT color=#0000ff size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=918154519-20092010><FONT color=#0000ff size=2
face=Arial>this._object.send(vData);if(bGecko&&!this._async){this.readyState=cXMLHttpRequest.OPENED;fSynchronizeValues(this);while(this.readyState<cXMLHttpRequest.DONE){this.readyState++;fReadyStateChange(this);if(this._aborted)</FONT></SPAN></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial></FONT></FONT></FONT><FONT color=#0000ff size=2
face=Arial><FONT color=#000000></FONT></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><FONT
color=#000000>v</FONT></FONT><FONT color=#0000ff size=2 face=Arial><FONT
color=#000000>ar info, infopop;<BR>
<BR> //Getfeatureinfo
object<BR> info = new
OpenLayers.Control.WMSGetFeatureInfo({<BR>
url: 'http://ITS701X5J1/RedWMS/Request.aspx',
<BR> title:
'Identify features by
clicking',<BR>
layers:
[layer_Garbage_Zones],<BR>
queryVisible:
true,<BR>
infoFormat:
'text/html',<BR>
maxFeatures:
1,<BR>
hover:true<BR>
});<BR>
<BR>
info.events.on({<BR>
getfeatureinfo: function(e)
<BR>
{<BR> //get
all existing
popups<BR> var
popups = Ext.WindowMgr.getBy(function(win){return (win instanceof
GeoExt.Popup)});<BR> <BR>
//kill all existing
popups<BR>
popups.each(function(popup){popup.destroy()});<BR> <BR>
//<ADDED CODE -
end><BR>
infopop = new GeoExt.Popup({ //utilizing the
GeoExt popup
functionality<BR>
title: "Hotspot
Information",<BR>
autoWidth:
true,<BR>
autoHeight:
true,<BR>
autoScroll:
false,<BR>
map:
map,<BR>
lonlat:
map.getLonLatFromPixel(e.xy),<BR>
html:
e.text<BR>
})<BR>
etext =
e.text;<BR>
// if the hotspot information is empty (layer doesn't match) don't
display!<BR>
if (etext.length ==
45)<BR>
{<BR>
infopop.close();<BR>
}<BR>
else<BR>
{<BR>
infopop.show();<BR>
}<BR>
}});<BR></FONT>
<BR><FONT
color=#000000>
map.addControl(info);<BR>
info.activate();</FONT></FONT></DIV>
<DIV dir=ltr align=left><BR> </DIV>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Matt Priour
[mailto:mpriour@kestrelcomputer.com] <BR><B>Sent:</B> September 20, 2010 1:39
PM<BR><B>To:</B> Andrew Stewart; users@geoext.org<BR><B>Subject:</B> Re: [Users]
GeoExt Popup / GetFeatureInfo, how do I destroy the popup if it
exists?<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT size=2 face=Arial>See added code below</FONT></DIV>
<DIV><FONT size=2 face=Arial>Matt Priour</FONT></DIV>
<DIV><FONT size=2 face=Arial>Kestrel Computer Consulting</FONT></DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><FONT face=Arial></FONT><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=Andrew.Stewart@reddeer.ca
href="mailto:Andrew.Stewart@reddeer.ca">Andrew Stewart</A> </DIV>
<DIV><B>Sent:</B> Monday, September 20, 2010 1:51 PM</DIV>
<DIV><B>To:</B> <A title=users@geoext.org
href="mailto:'users@geoext.org'">'users@geoext.org'</A> </DIV>
<DIV><B>Subject:</B> [Users] GeoExt Popup / GetFeatureInfo, how do I destroy the
popup if it exists?</DIV></DIV></DIV>
<DIV><FONT size=2 face=Arial></FONT><BR></DIV><FONT size=2
face="Arial, sans-serif">
<DIV>Below is my code for when I hover over a specific layer and the popup
hotspot information is shown. I am trying to figure out how to only get one
popup to show at a time so that I can show them like tooltips and destroy the
existing one if another is shown. I have tried using if (infopop) or if
(!infopop) but this doesn't seem to work in the way I have this coded. If anyone
has any advice on how to destroy my popup when another is created thanks!</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>var info, infopop;</DIV>
<DIV> </DIV>
<DIV> //Getfeatureinfo object</DIV>
<DIV> info = new
OpenLayers.Control.WMSGetFeatureInfo({</DIV>
<DIV>
url: '<A href="http://ITS701X5J1/RedWMS/Request.aspx"><FONT
color=#0000ff><U>http://ITS701X5J1/RedWMS/Request.aspx</U></FONT></A>', </DIV>
<DIV> title:
'Identify features by clicking',</DIV>
<DIV> layers:
[layer_Garbage_Zones],</DIV>
<DIV>
queryVisible: true,</DIV>
<DIV> infoFormat:
'text/html',</DIV>
<DIV> maxFeatures:
1,</DIV>
<DIV>
hover:true</DIV>
<DIV> });</DIV>
<DIV> </DIV>
<DIV>
info.events.on({</DIV>
<DIV>
getfeatureinfo: function(e) {</DIV>
<DIV>
<ADDED CODE - begin></DIV>
<DIV> </DIV>
<DIV> //get
all existing popups</DIV>
<DIV> var
popups = Ext.WindowMgr.getBy(function(win){return (win instanceof
GeoExt.Popup)});</DIV>
<DIV> </DIV>
<DIV> //kill
all existing popups</DIV>
<DIV> popups.each(function(popup){popup.destroy()});</DIV>
<DIV> </DIV>
<DIV> <ADDED
CODE - end></DIV>
<DIV>
infopop = new GeoExt.Popup({ //utilizing the
GeoExt popup functionality</DIV>
<DIV>
title: "Hotspot Information",</DIV>
<DIV>
//height: 215,</DIV>
<DIV>
//width: 600,</DIV>
<DIV>
autoWidth: true,</DIV>
<DIV>
autoHeight: true,</DIV>
<DIV>
autoScroll: false,</DIV>
<DIV>
// panIn: true,</DIV>
<DIV>
map: map,</DIV>
<DIV>
lonlat: map.getLonLatFromPixel(e.xy),</DIV>
<DIV>
html: e.text</DIV>
<DIV>
})</DIV>
<DIV>
</DIV>
<DIV>
etext = e.text;</DIV>
<DIV>
// if the hotspot information is empty
(layer doesn't match) don't display!</DIV>
<DIV>
if (etext.length == 45)</DIV>
<DIV>
{</DIV>
<DIV>
infopop.close();</DIV>
<DIV>
}</DIV>
<DIV>
else</DIV>
<DIV>
{</DIV>
<DIV>
infopop.show();</DIV>
<DIV>
}</DIV>
<DIV>
}});</DIV>
<DIV> </DIV>
<DIV>
</DIV>
<DIV> map.addControl(info);</DIV>
<DIV> info.activate();</DIV>
<DIV> </DIV>
<DIV> </DIV></FONT>
<DIV>
<P>
<HR>
This e-mail is intended for the original recipient(s) only. If you have received
it in error, please advise the sender and delete this message.
<P></P></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>Users mailing
list<BR>Users@geoext.org<BR>http://www.geoext.org/cgi-bin/mailman/listinfo/users<BR>
<DIV>
<P>
<HR>
[This message has been scanned for security content threats and
viruses.]<BR><BR>[The City of Red Deer I.T. Services asks that you please
consider the environment before printing this e-mail.]<BR>
<P></P></DIV>
<DIV><P><HR>
This e-mail is intended for the original recipient(s) only. If you have received it in error, please advise the sender and delete this message.
</P></DIV>
</BODY></HTML>