Thank you very much Eric. I modified the real application according to your suggestions and it works great.
Mike ----- Original Message ----- From: "Eric Lemoine" <[email protected]> To: "Michael Anderson" <[email protected]> Cc: <[email protected]> Sent: Monday, August 17, 2009 4:00 PM Subject: Re: [OpenLayers-Users] programmatically select feature to modify - worked in 2.7 but doesn't in 2.8 On Fri, Aug 14, 2009 at 11:06 PM, Michael Anderson<[email protected]> wrote: > Hello, > > I have an app that works in 2.7 but not in 2.8. What I need to do is > programmatically select a feature and select it for editing. Works fine in > 2.7. In 2.8 the feature is selected, but the vertices are not displayed > and > it's not editable. > > When I initially got it working I sort of stumbled on to it and was a > little > surprised it worked. I created both ModifyFeature and SelectFeature > controls > on the same layer, and then if I activated the modify control and selected > the feature with the select control the feature was selected and editable. > I'm thinking it wasn't supposed to work this way and was corrected in 2.8. > > I created a simplified example, which is attached to this message. The > html > page is also available here in case the it doesn't come through: > http://128.118.7.3/testing/testSelect.html. To run it just hit the > 'Select' > button in the upper left corner. > > The example is using 2.7 from a server I control so it works. If you > comment > out the javascript reference on line 4 and uncomment the one on line 3 it > will use the hosted version of 2.8. Then it won't work. > > If I am correct that this shouldn't have worked before, is there a way I > can > do the same think properly? Hi. I made a couple changes to your example and got it to work both with 2.7 and 2.8: - remove the select control - activate the modify control after it is added to the map - programmatically select the feature through the modify feature control's internal select feature control - add a hack to fool the select feature control's feature handler (related to <http://trac.openlayers.org/ticket/2204>). Also note that ModifyFeature in trunk includes the property "standalone", which may just accommodate your case. See <http://dev.openlayers.org/apidocs/files/OpenLayers/Control/ModifyFeature-js.html#OpenLayers.Control.ModifyFeature.standalone> Cheers, -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : [email protected] http://www.camptocamp.com _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
