windrobin / winforms-geplugin-control-library

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

Events do not work either #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Implement the same event testing as in the sample application with the 
current version of the library

What is the expected output? What do you see instead?
Normally events should be thrown. That does not happen.

What version of the product are you using? On what operating system?
Windows 7 IE 9, VS 2010, latest version r430

Please provide any additional information below.

Original issue reported on code.google.com by der.hots...@googlemail.com on 30 Nov 2011 at 12:01

GoogleCodeExporter commented 9 years ago
Got it, I think it is IE 9 not liking the eventID's - that is, the names like 
"click, balloonclose, viewchangeend, etc". It appears that IE 9 does not like 
these in uppercase. Will fix asap. BTW, if you want to fix yourself, just 
replace the two functions jsAddEventListener and jsRemoveEventListener in the 
Plugin.html file with these below.

    /**
    * google.earth.addEventListener wrapper.
    * Attaches a listener to a given object for a specific event; when the event occurs on the object, the given callback is invoked.
    * @param feature {object} The object on which to listen to the event.
    * @param hash {int} A unique hash for the object supplied in the feature parameter.
    * @param action {string} The event string identifying the event to listen for.
    * @param callback {string} A function that will be called when the event occurs on the object.
    */
    var jsAddEventListener = function(feature, hash, action, callback, useCapture)
    {     
      action = action.toLowerCase();
      if(action == "viewchangebegin" || action == "viewchange" || action == "viewchangeend")
      {
        // view events 
        events_.view[action] = function() { viewEventListener_(action); };
        google.earth.addEventListener(feature, action, events_.view[action], useCapture);
      }
      else if(action == "frameend" || action == "balloonclose" || action == "balloonopening")
      {
        // plugin events
        events_.plugin[action] = function() { pluginEventListener_(action); };
        google.earth.addEventListener(feature, action, events_.plugin[action], useCapture);
      }
      else
      {
        // generic events
        if(null == callback)
        {
          callback = function(event) { kmlEventListener_(event, action); };
        } 

        events_.generic[hash] = callback;
        google.earth.addEventListener(feature, action, eval(events_.generic[hash]), useCapture);
      }
    }

    /**
    * google.earth.removeEventListener wrapper.
    * Removes an event listener previously added using google.earth.addEventListener() from the event chain.
    * @param feature {object} The object on which to listen to the event.
    * @param hash {int} A unique hash for the object supplied in the feature parameter.
    * @param action {string} The event string identifying the event to listen for.
    * @param callback {string} The function that was set as the callback.
    */
    var jsRemoveEventListener = function(feature, hash, action, callback, useCapture)
    {      
      action = action.toLowerCase();
      if(action == "viewchangebegin" || action == "viewchange" || action == "viewchangeend")
      {
        // view events 
        google.earth.removeEventListener(feature, action, events_.view[action], useCapture);
        events_.view[action] = null;
      }
      else if(action == "frameend" || action == "balloonclose" || action == "balloonopening")
      {
        // plugin events
        google.earth.removeEventListener(feature, action, events_.plugin[action], useCapture);
        events_.plugin[action] = null;
      }      
      else
      {       
        // generic events
        google.earth.removeEventListener(feature, action, events_.generic[hash], useCapture);
        events_.generic[hash] = null;
      }
    }

Original comment by fraser.c...@gmail.com on 2 Dec 2011 at 7:24

GoogleCodeExporter commented 9 years ago
Fixed in revision 431

Original comment by fraser.c...@gmail.com on 12 Dec 2011 at 8:32