thientung / winforms-geplugin-control-library

Automatically exported from code.google.com/p/winforms-geplugin-control-library
GNU General Public License v3.0
0 stars 0 forks source link

Display the Ballon content in a TextBox #93

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
My requirement is that when user clicks the balloon, i want to display the 
content of that balloon displayed in a text box outside the plug-in.

I am not finding any way where it can be recorded a which Placemark has been 
clicked and i can access the content of the balloon.

Can anybody help on this?

Original issue reported on code.google.com by nitinkum...@gmail.com on 17 Sep 2012 at 8:27

GoogleCodeExporter commented 9 years ago
I have used the follwing code to access the balloon clicked on the plugin in 
plugin.html file. 

google.earth.addEventListener(feature, action, events_.generic[hash], 
useCapture,initCB); google.earth.addEventListener(ge, 'balloonopening', 
function(event) {event.preventDefault();var placemark = 
event.getBalloon().getFeature();var placemark_desc = 
placemark.getDescription();var placemark_name = placemark.getName();var 
placemark_desc_active = 
placemark.getBalloonHtmlUnsafe();addData(placemark_desc_active );})

Further in the function addData i have done the follwing to add this text to 
the textBox i have created: 

function addData(text){ var TheTextBox = document.getElementById("Mytextbox"); 
TheTextBox.value = TheTextBox.value + text; } 

But i dont see any text in the box when i click the balloon. 

Original comment by nitinkum...@gmail.com on 24 Sep 2012 at 6:46

GoogleCodeExporter commented 9 years ago
It would be simply a case of adding a listener and then extracting the relevant 
information.

Take a look at the following example:
http://code.google.com/p/winforms-geplugin-control-library/wiki/AddEventListener

Where the line:  MessageBox.Show(e.ApiObject.getTarget().getType()); // GEGlobe

is you should be able to call.

e.ApiObject.getTarget().getBalloonHtmlUnsafe()

and then use that information however you want.

Original comment by fraser.c...@gmail.com on 18 Nov 2012 at 7:16