disable click for results

4 views
Skip to first unread message

sarris

unread,
Feb 12, 2009, 2:26:31 PM2/12/09
to Google AJAX APIs
Hi there, i am using the LocalSearch control.
I would like to be able to disallow the users to click on the results
on the map under certain circumstances. Is there a way to implement
this? Is there a way to remove the clicking event from the markers?

Ioustinos Sarris

unread,
Feb 12, 2009, 3:42:27 PM2/12/09
to Google AJAX APIs

Jeremy Geerdes

unread,
Feb 12, 2009, 11:18:18 PM2/12/09
to Google-AJAX...@googlegroups.com
Unfortunately, I don't know that there is an easy way to do this with
the google.maps.LocalSearch control. You could, however, add an
onGenerateMarkerHtml callback that would set a timeout of, say, 100
milliseconds to call map.closeInfoWindow(). Something like this would
close the infowindow almost immediately after it was opened:

lsc.onGenerateMarkerHtmlCallback=function(){setTimeout({function()
{map.closeInfoWindow();},100);}; // where lsc is the LocalSearch
control, and map is the map it's on.

Then, to re-allow the infowindow, you would call
lsc.onGenerateMarkerHtmlCallback=null;

You might also be able to override LocalSearch.prototype.bootComplete
before you initialize the control so that, instead of using
GEvent.bind to assign the click listener, it calls an enable routine
that would look something like this:

google.maps.LocalSearch.prototype.enableMarkerClick=function(){
var lsc=this;
lsc
.clickListener
=GEvent.addListener(lsc.gmap,'click',function(marker,point)
{lsc.onMapClick(marker,point);});
}

Then you could add a disable routine like this:

google.maps.LocalSearch.prototype.disableMarkerClick=function(){
var lsc=this;
if(lsc.clickListener){GEvent.removeListener(lsc.clickListener);}
lsc.clickListener=null;
}

Beware, I haven't tested any of this, so it might not work at all.
Just brainstorming.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
http://jgeerdes.blogspot.com
http://jgeerdes.wordpress.com
jgee...@mchsi.com

Unless otherwise noted, any price quotes contained within this
communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com
!

sarris

unread,
Mar 3, 2009, 12:08:35 PM3/3/09
to Google AJAX APIs
thanks, gave me some nice ideas there!
> jgeer...@mchsi.com
>
> Unless otherwise noted, any price quotes contained within this  
> communication are given in US dollars.
>
> If you're in the Des Moines, IA, area, check out Debra Heights  
> Wesleyan Church!
>
> And check out my blog, Adventures in Web Development, athttp://jgeerdes.blogspot.com
Reply all
Reply to author
Forward
0 new messages