[OpenLayers-Users] How to programmatically open/close Popup?

Alexandre Dube adube at mapgears.com
Fri Mar 12 08:25:36 EST 2010


Hi Steve,

You could manually trigger the "unselect" method of the ModifyFeature 
control to unselect the currently selected feature, something like this :

map.controls[7].selectControl.unselect(map.layers[1].selectedFeatures[0]);

Instead of using the control and layer from their arrays, I would use 
variable names (when creating them), like instead of doing 
map.addControl(new OpenLayers.Control....), I prefer doing var myVar= 
new OL.ctrl.... and then map.addCtrl(myVar)

Also, instead of using onSelect and onUnselect methods of the 
ModifyFeature control, try registering "select" and "unselect" events on 
the layer, because the above solution won't work unless you do so.

Try that and tell me about it.

Best regards,

Alexandre


Stephen Woodbridge wrote:
> Hi all,
>
> I have an OpenLayers.Popup.FramedCloud popup that contains a form for 
> entering/editing a features attributes. The form has a save button with 
> an onClick function attached that needs to save the data to the server 
> then close the popup. Currently the button only issue an alert.
>
> How can I programmatically trigger the close from my onclick handler?
>
> You can see example here:
> http://imaptools.com:8080/tilecache/test.html?zoom=17&lat=33.89595&lon=35.49935&layers=BT
>
> 1) load page, pan slightly to work around feature load bug
> 2) click left most tool in tool bar
> 3) click on green POI (you should get popup)
>
> I have only worked on this in FF, others might not work yet.
>
> I have looked over the event code and the popup code, but I'm not seeing 
> a way to do this.
>
> Thanks,
>    -Steve
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list