[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re[6]: [cgmo-webcgm] Issue: addEventListener
The formatting is getting messy, so I won't go inline. i) Regarding the listeners on the metafile interface... You are thinking of the Metafile interface being a direct link to the CGM Metafile. That's fine, but it could also be seen as a place holder for the picture. All an implementation has to do to support the Metafile interface is provide the following information: -metafileDescription; -firstPicture; -metafileID; -metafileVersion; -src; That's not much and there are many ways of implementing this functionality. Also, if you do: var meta = getWebCGMDocument(); meta.src = doc1.cgm; meta.src = doc2.cgm; When you set doc2.cgm, the 'meta' object wasn't destroyed by IE and recreated, it still has it's original IDispatch value. That's why I say that an implementation could maintain the information around. If the name 'Metafile' is causing some confusion, we can change it. Again Ralf, if I'm talking nonsense, please let me know and I'll shut up. ii) What I don't like about the default event handlers is that they possibly make addEventListener and removeEventListener obsolete. i.e., why have a default event handler for the 'load' event and not the other events? iii) What I meant by add onload="function to call" as some sort of parameter to the object tag was this: <object data="xxx.cgm" type="image/cgm;Version=4;ProfileId=WebCGM"; width="200"; height="100"> <param name="onload" value="myHandler(evt);"/> </object> iv) Would you mind providing more information of what you meant by: "Some solution might be to install a default handler with the viewer, and the viewer installs it on the opening document as early as possible." I'm not sure I'm catching all of it (sorry). Regards, -- Benoit mailto:benoit@itedo.com Monday, March 21, 2005, 12:58:57 PM, Dieter wrote: DW>> and it would be removed by closing first.cgm before opening second.cgm, DW> I'm not so sure about that, I think an implementation could keep the DW> information around. Ralf (co-worker), let me know if I'm wrong. DW> DW: I am not sure about this. The listener is added to the metafile DW> interface (once we make that change). Is that interface supposed to survive DW> if the file is closed? What would it point to then? DW>> so it wouldn't be called for second.cgm either, right? DW> I think it could get called for second.cgm, but still, the problem DW> exists for first.cgm. DW> DW: again, not convinced yet. DW>> Some solution might be to install a default handler with the viewer, DW>> and the viewer installs it on the opening document as early as possible. DW> Default handlers or listeners? DW> In the case of handlers, you are in fact suggesting that we agree on a DW> function name, and that upon loading the viewer calls that function if DW> it present in the HTML script, right? DW> DW: Both are ways we could go imo. DW> Could some other approach be: DW> - add onload="function to call" inside the CGM itself? DW> DW: No, I don't think so. This would restrict usage of the CGM too much, DW> and it would require some kind of metadata structure inside the CGM that DW> is not part of WebCGM so far. DW> - or add onload="function to call" as some sort of parameter to the DW> object tag? DW> DW: this is one idea. Still we need an interface to attach it to at that DW> point. DW> - or simply document that for the 'load' event, you need to set the DW> event listener before setting 'src'; and that 'load' doesn't work if DW> the source filename is set on the object tag. DW> DW: to complicated imo for scripters, and it would imply that you need to DW> use "src" to load a cgm. Eg, what about linkURIs inside the CGM? DW> Regards, DW> Dieter DW> -----Original Message----- DW> From: Benoit Bezaire [mailto:benoit@itedo.com] DW> Sent: Monday, March 21, 2005 6:41 PM DW> To: Dieter Weidenbrueck DW> Cc: Ulrich Laesche; cgmo-webcgm@lists.oasis-open.org DW> Subject: Re[4]: [cgmo-webcgm] Issue: addEventListener DW> Hi all, DW> First, a few questions to Ulrich... DW> - Could you provide us with a few lines of JS that would illustrate DW> how your default event listener works in your viewer? DW> - Is the 'onload' the only default event listener you support? DW> Dieter... please see inline... DW> Monday, March 21, 2005, 11:54:06 AM, Dieter wrote: DW>> I think that an onLoad event needs to be installed somehow with the DW> viewer DW>> rather than with the document. DW> You may be right, but this may not be easy to do. (not sure yet). DW>> Consider the following (assuming that the addEventListener method is DW> moved DW>> up to the metafile interface: DW> Ok. DW>> <script language="JavaScript"> DW>> function handleLoad(evt) DW>> { DW>> window.alert( "load finished" ); DW>> } DW>> function init() DW>> { DW>> var cgmDoc = DW>> document.getElementById("ivx1").getWebCGMDocument(); DW>> cgmDoc.src = 'first.cgm'; DW>> cgmDoc.addEventListener( "load", handleLoad ); DW>> cgmDoc.src = 'second.cgm'; } DW>> </script> DW>> As of now, handleLoad wouldn't be called for first.cgm, DW> Correct. DW>> and it would be removed by closing first.cgm before opening second.cgm, DW> I'm not so sure about that, I think an implementation could keep the DW> information around. Ralf (co-worker), let me know if I'm wrong. DW>> so it wouldn't be called for second.cgm either, right? DW> I think it could get called for second.cgm, but still, the problem DW> exists for first.cgm. DW>> It would be good to know how the SVG folks handle this case. DW> Both HTML and SVG support the predefined event listeners: onload, DW> onclick, onmousemove etc... DW> <html onload="do something"...> DW> or DW> <svg onload="do something"...> DW> So, while reading the file, an implementation can add the event DW> handler _before_ the document is finished loading _and_ execute it DW> before the first rendering. DW>> Some solution might be to install a default handler with the viewer, DW>> and the viewer installs it on the opening document as early as possible. DW> Default handlers or listeners? DW> In the case of handlers, you are in fact suggesting that we agree on a DW> function name, and that upon loading the viewer calls that function if DW> it present in the HTML script, right? DW> Could some other approach be: DW> - add onload="function to call" inside the CGM itself? DW> - or add onload="function to call" as some sort of parameter to the DW> object tag? DW> - or simply document that for the 'load' event, you need to set the DW> event listener before setting 'src'; and that 'load' doesn't work if DW> the source filename is set on the object tag. DW> Thoughts? DW> -- DW> Benoit mailto:benoit@itedo.com DW>> Dieter DW>> -----Original Message----- DW>> From: Ulrich Laesche [mailto:ulrich@ematek.de] DW>> Sent: Monday, March 21, 2005 4:24 PM DW>> To: cgmo-webcgm@lists.oasis-open.org DW>> Subject: FW: Re[2]: [cgmo-webcgm] Issue: addEventListener DW>> Sorry, I hit the wrong reply button. DW>> -----Original Message----- DW>> From: Benoit Bezaire [mailto:benoit@itedo.com] DW>> Sent: Montag, 21. Marz 2005 15:58 DW>> To: Ulrich Laesche DW>> Subject: Re[2]: [cgmo-webcgm] Issue: addEventListener DW>> Hi Ulrich, DW>> I was wondering if you could CC the group? I want to CC the group (I DW>> think they should be involved). Do you mind resending, and doing a DW>> reply all. DW>> -- DW>> Benoit mailto:benoit@itedo.com DW>> Monday, March 21, 2005, 8:15:37 AM, Ulrich wrote: UL>>> Hi Benoit, UL>>> Once installed, the event handler should be triggered on a Reload DW>> Picture UL>>> occurrance, right? Still, this doesn't solve the problem you described UL>>> below (unless you want to load an image twice to execute some onload UL>>> actions). UL>>> So far, we (Ematek) always assumed the onload event handler in the DW>> script UL>>> being present by default (like in your SVG sample). Apparently the DW> spec DW>> now UL>>> says that no event handler is present by default and that it needs to DW> be UL>>> installed prior to become active. UL>>> We could assume that the load action is not finished before the second DW>> line UL>>> of the script is recognized (when moving the load handler to the DW>> Metafile UL>>> interface, cgmDoc.addEventListener( "load", handleLoad )). However, DW>> this is UL>>> mere speculation and may work or not depending on the implementation or UL>>> performance. UL>>> What does the SVG standard propose in this respect? As the Event DW>> handling UL>>> mechanism should work with all other events the onload should either be UL>>> handled the same way (with some reasonable behavior assumptions) or DW>> become a UL>>> different method. UL>>> Regards UL>>> Ulrich UL>>> -----Original Message----- UL>>> From: Benoit Bezaire [mailto:benoit@itedo.com] UL>>> Sent: Donnerstag, 17. Marz 2005 18:41 UL>>> To: CGMO WebCGM TC UL>>> Subject: [cgmo-webcgm] Issue: addEventListener UL>>> Hi CGMO, UL>>> We came upon a problem while working on addEventListener... If you UL>>> consider the following ECMAScript: UL>>> <script language="JavaScript"> UL>>> function handleLoad(evt) UL>>> { UL>>> window.alert( "load finished" ); UL>>> } UL>>> function init() UL>>> { UL>>> var cgmDoc = UL>>> document.getElementById("ivx1").getWebCGMDocument(); UL>>> cgmDoc.src = 'appstructure.cgm'; UL>>> cgmPic = cgmDoc.firstPicture; UL>>> cgmPic.addEventListener( "load", handleLoad ); UL>>> } UL>>> </script> UL>>> The problem is that the "load" event will never be triggered because UL>>> by the time you get to the addEventListener, the document is already UL>>> fully loaded. UL>>> Do people know if moving the addEventListner to the WebCGMMetafile UL>>> interface solves the problem? Ulrich, your guys worked on this, UL>>> right? UL>>> Assuming the source file was set on the <object> tag and that the UL>>> addEventListener method was on the WebCGMMetafile, would the UL>>> following code work? UL>>> function init() UL>>> { UL>>> var cgmDoc = UL>>> document.getElementById("ivx1").getWebCGMDocument(); UL>>> cgmDoc.addEventListener( "load", handleLoad ); UL>>> } UL>>> I'm thinking no... I tried this with an SVG viewer and it didn't UL>>> work (but it could be a bug). I can only get the load event to be UL>>> tricked if the event listener is already in the SVG file: UL>>> <svg onload="do something"...> UL>>> Is there a way to catch the 'load' event in a WebCGM viewer UL>>> implementation? UL>>> -- UL>>> Benoit mailto:benoit@itedo.com
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]