[mapguide-users] OnSelection Event?
Jackie Ng
jumpinjackie at gmail.com
Thu Jan 8 18:12:06 EST 2009
This is javascript code that hooks onto events from the viewer frame.
So the code should go in the page that launches the viewer frame.
A more detailed explaination here:
http://trac.osgeo.org/mapguide/wiki/CodeSamples/JavaScript/AJAXViewerEventHooking
- Jackie
clarkie342 wrote:
>
> Hi Jason,
>
> I am trying to implement your suggestion below to make use of the
> OnSelectionChanged Event Handler in mainframe.templ
> I have a asp.net page with iframe showing a mapguide map. I want to be
> able to do bunch of things when the user selects features on this map.
> I am not very clear on how you are implementing your SelectionChanged
> function instead of the original one. Where should this script go?
> Appreciate your help.
>
> Thanks
>
>
> Jason Birch wrote:
>>
>>
>> There is an OnSelectionChanged function in the main frame, but it doesn't
>> appear to be documented.
>>
>> I've just tried playing around with this, and I got the following to work
>> when inserted into the <head> of the ajaxviewersample.php file. It does
>> not appear to work with the DWF viewer; maybe why it's not documented?
>> Or it could just be that my code is bad :)
>>
>> <script type="text/javascript" >
>>
>> var originalOnSelectionChanged;
>> var initTimer = setInterval(watchInitialized, 200);
>>
>> function watchInitialized () {
>> try {
>> if(ViewerFrame.mapFrame.mapInit)
>> {
>> clearInterval(initTimer);
>> originalOnSelectionChanged = ViewerFrame.OnSelectionChanged;
>> ViewerFrame.OnSelectionChanged = MyOnSelectionChangedHandler;
>> }
>> }
>> catch(Exception) {}
>> }
>>
>> function MyOnSelectionChangedHandler() {
>> originalOnSelectionChanged ();
>> var mapFrame = ViewerFrame.GetMapFrame();
>> selCount = mapFrame.GetSelectedCount();
>> alert("Selected: " + selCount);
>> }
>>
>> </script>
>>
>>
>>
>> ________________________________
>>
>> From: Willem Schwarte [mailto:willem at giskit.nl]
>> Subject: [mapguide-users] OnSelection Event?
>>
>>
>> I suppose there is no onSelectionChanged event like in MG6.5. So this
>> would be done on a onClick? Where would I put the code for this?
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
>> For additional commands, e-mail: users-help at mapguide.osgeo.org
>>
>
>
--
View this message in context: http://n2.nabble.com/OnSelection-Event--tp1804304p2130787.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list