You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Andreas Neumann <ne...@karto.baug.ethz.ch> on 2005/12/18 12:12:39 UTC

Problem with selectionList / remove eventListener

Hello,

I have a problem with the following selectionList / ECMAScript Code and 
removing eventListeners from my document.documentElement.

I am refering to the example at:
http://www.carto.net/papers/svg/gui/selectionlist/index.svg

When one opens a selectionList, I add a "click" and "keypress"  event 
listener to the document.documentElement in order to allow for open 
selectionlists to close if the user clicks outside the selectionlist. 
This works fine in Batik, the selectionlist closes properly when the 
event was received from the svg-element. However, it seems the event 
listener is not properly removed from the document.documentElement 
(which should be done in the file "selectionList.js" in the method 
".foldList()"). Maybe I am doing something wrong, but I don't find my 
mistake. Why aren't the eventListeners properly removed?

There is a tar.gz archive of all related files available at 
http://www.carto.net/papers/svg/gui/selectionlist/selectionList.tar.gz.

Any help on this problem is very much appreciated.

I tested with the latest svn release and also with batik 1.6 with the 
same results/problems.

Thanks a lot,
Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Problem with selectionList / remove eventListener

Posted by Andreas Neumann <ne...@karto.baug.ethz.ch>.
Hi Thomas,

thank you very much for the quick fix and the hint to avoid that problem 
in older releases! I will have a look at the solitaire example.

I can confirm that my example works now fine in the SVN version.

Thanks again,
Andreas

thomas.deweese@kodak.com wrote:
> Hi Andreas,
> 
>     This turned out to be a bug in Batik's event proxies for JavaScript.
> The basic form of the bug is that if you registered for two events on the
> same 'listener' the remove would only ever remove the last registered 
> listener.
> 
>     The best workaround for this would be to introduce  small 'forwarding' 
> 
> listeners.  This is what I tend to do in this case and likely the reason 
> it
> wasn't noticed earlier.  For an example of this take a look at my 
> solitaire
> examples.  In particular util.js has some 'forwarding' function objects
> and the pile.js uses them as members which it registers so that it gets
> it's 'mousemove' function called for mouse moves instead of the 
> generic 'handleEvent'.
> 
>     This is now fixed in SVN.
> 
> Andreas Neumann <ne...@karto.baug.ethz.ch> wrote on 12/18/2005 06:12:39 
> AM:
> 
>> Hello,
>>
>> I have a problem with the following selectionList / ECMAScript Code and 
>> removing eventListeners from my document.documentElement.
>>
>> I am refering to the example at:
>> http://www.carto.net/papers/svg/gui/selectionlist/index.svg
>>
>> When one opens a selectionList, I add a "click" and "keypress"  event 
>> listener to the document.documentElement in order to allow for open 
>> selectionlists to close if the user clicks outside the selectionlist. 
>> This works fine in Batik, the selectionlist closes properly when the 
>> event was received from the svg-element. However, it seems the event 
>> listener is not properly removed from the document.documentElement 
>> (which should be done in the file "selectionList.js" in the method 
>> ".foldList()"). Maybe I am doing something wrong, but I don't find my 
>> mistake. Why aren't the eventListeners properly removed?
>>
>> There is a tar.gz archive of all related files available at 
>> http://www.carto.net/papers/svg/gui/selectionlist/selectionList.tar.gz.
>>
>> Any help on this problem is very much appreciated.
>>
>> I tested with the latest svn release and also with batik 1.6 with the 
>> same results/problems.
>>
>> Thanks a lot,
>> Andreas
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


-- 
----------------------------------------------
Andreas Neumann - Institute of Cartography
Swiss Federal Institute of Technology (ETH)
ETH Hoenggerberg
CH-8093  Zurich, Switzerland
Phone: ++41-1-633 3031, Fax: ++41-1-633 1153
e-mail: neumann@karto.baug.ethz.ch
www: http://www.carto.net/neumann/
SVG.Open: http://www.svgopen.org/
Carto.net: http://www.carto.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: Problem with selectionList / remove eventListener

Posted by th...@kodak.com.
Hi Andreas,

    This turned out to be a bug in Batik's event proxies for JavaScript.
The basic form of the bug is that if you registered for two events on the
same 'listener' the remove would only ever remove the last registered 
listener.

    The best workaround for this would be to introduce  small 'forwarding' 

listeners.  This is what I tend to do in this case and likely the reason 
it
wasn't noticed earlier.  For an example of this take a look at my 
solitaire
examples.  In particular util.js has some 'forwarding' function objects
and the pile.js uses them as members which it registers so that it gets
it's 'mousemove' function called for mouse moves instead of the 
generic 'handleEvent'.

    This is now fixed in SVN.

Andreas Neumann <ne...@karto.baug.ethz.ch> wrote on 12/18/2005 06:12:39 
AM:

> Hello,
> 
> I have a problem with the following selectionList / ECMAScript Code and 
> removing eventListeners from my document.documentElement.
> 
> I am refering to the example at:
> http://www.carto.net/papers/svg/gui/selectionlist/index.svg
> 
> When one opens a selectionList, I add a "click" and "keypress"  event 
> listener to the document.documentElement in order to allow for open 
> selectionlists to close if the user clicks outside the selectionlist. 
> This works fine in Batik, the selectionlist closes properly when the 
> event was received from the svg-element. However, it seems the event 
> listener is not properly removed from the document.documentElement 
> (which should be done in the file "selectionList.js" in the method 
> ".foldList()"). Maybe I am doing something wrong, but I don't find my 
> mistake. Why aren't the eventListeners properly removed?
> 
> There is a tar.gz archive of all related files available at 
> http://www.carto.net/papers/svg/gui/selectionlist/selectionList.tar.gz.
> 
> Any help on this problem is very much appreciated.
> 
> I tested with the latest svn release and also with batik 1.6 with the 
> same results/problems.
> 
> Thanks a lot,
> Andreas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org