Atozed Forums
IWCL_HookEvent in IWCommon.js correct? - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: IWCL_HookEvent in IWCommon.js correct? (/thread-976.html)



IWCL_HookEvent in IWCommon.js correct? - jeroen.rottink - 02-28-2019

This function is called internally by IW to attach an event handler to an object. For example an onclick event.
If the html already declares an onclick event listener for that object, IWCL_HookEvent moves this original event handler to an internal structure (array[]) and adds the new one.
This way they both get called I presumed but that didn't work.
Debugging the code I am not sure if following is ok.

Code:
   IWCL_HookEvent: function(eventName, eventHandler) {
       var i = IW.Events.findByName(eventName);
       logMessage("IWCL_HookEvent(): eventName = " + eventName);
       if (this.IEEventHandlers[i] == null) {
           this.IEEventHandlers[i] = [];
           var xEventName = "on" + eventName;
           if (this[xEventName] != null) {
               this.IEEventHandlers[0] = this[xEventName]       // <<-- replace with this.IEEventHandlers[i][0] = this[xEventName]  ?????
           }
           this[xEventName] = IW.Events.IWEventHandler;
       }



RE: IWCL_HookEvent in IWCommon.js correct? - Alexandre Machado - 02-28-2019

Interesting.... At first, seems that your assumption is correct. I'll check it and let you know.


RE: IWCL_HookEvent in IWCommon.js correct? - Alexandre Machado - 03-04-2019

Which version are you using Jeroen? I believe you are correct. I'm performing some tests and if everything is OK I can release both a new update or a path, depending on the version you are using.


RE: IWCL_HookEvent in IWCommon.js correct? - jeroen.rottink - 03-05-2019

(03-04-2019, 10:01 AM)Alexandre Machado Wrote: Which version are you using Jeroen? I believe you are correct. I'm performing some tests and if everything is OK I can release both a new update or a path, depending on the version you are using.

I found it using IW15.0.17. Retested with IW15.0.18. Same code here.
FYI: I made the change myself in the debug version and it fixes my problem.


RE: IWCL_HookEvent in IWCommon.js correct? - kudzu - 03-05-2019

Thanks. Putting this in 15.0.19 will be easy.


RE: IWCL_HookEvent in IWCommon.js correct? - ShaneStump - 03-06-2019

Howdy all!

I bet this is the cause of one of the issues I was having where an OnXXX wasn't getting called!

All the best,

Shane