André, André Silva wrote: > I shall step by step what I tried to do: > > 1) Get a file (CoordsPopup.js) with the following javascript content > below and put in the directory mapbuilder/lib/widget
First question: do you want to create a custom button for a specific application, or do you want to create a generic one that you want to contribute to the MapBuilder project? In the former case, you should not put it into mapbuilder/lib/widget, to make upgrading easier. You can still let your config point to the correct script path, using the <scriptFile> property. In any case, an updated tutorial on creating buttons can be found here: http://docs.codehaus.org/display/MAP/Add+Button+Tutorial > > /* > License: LGPL as per: http://www.gnu.org/copyleft/lesser.html > Dependancies: Context > $Id: WfsGetFeature.js 1779 2005-11-01 13:28:05Z cappelaere $ > */ > This is from a very old version of MapBuilder, and the way buttons are created has changed since then, because now buttons are based on OpenLayers controls. I would recommend that you use MapBuilder 1.5rc1, and create your button according to the tutorial mentioned above. For the action to be created in your case, you can have a look at the GetFeatureInfoWSR widget. It registers for click events in the doSelect method, and calls the doOnClick method when the user clicks on the map. Your doOnClick method could look like this: this.doOnClick = function(e) { var coord = objRef.targetModel.map.getLonLatFromPixel(e.xy); var pointx = coord.lon; var pointy = coord.lat; // now you can do your popup stuff } Regards, Andreas. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Mapbuilder-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mapbuilder-users
