[OpenLayers-Users] How to use the getMousePosition() in the OpenLayers.Control.SelectFeature's event handler function?

ahwangyuwei at sina.com ahwangyuwei at sina.com
Thu Jun 9 02:33:06 EDT 2011


 Hello:
      I am using the openlayers2.8. 
      I want to add a popup about the feature at the mouse click position, and I saw that I can use the OpenLayers.Control.SelectFeature to select feature and hightlight the feature. I have met a problem How to get the mouse's click postion in the event("featurehighlighted") hanlder  function ("report"). I try this:   var report = function(e) {
                //OpenLayers.Console.log(e.type, e.feature.id);
                map.addPopup(new OpenLayers.Popup.FramedCloud(
                        "chicken", 
                        map.getLonLatFromPixel(e.object.events.getMousePosition(e.object.handlers.feature.evt)),
                        null,
                        "<div>ss</div>",
                        null,
                        true
                    ));       
                 
            };

But In getMousePosition()  a error occurred: "this.element is null".
I want to ask: How to get the click position?  What is the function getMousePosition's parameters ?

Looking forward to your help.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wang 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CNIC,CAS,China


  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110609/7f31a5ad/attachment-0001.html


More information about the Users mailing list