Bug 312 : Library API unregister for events.
Last modified: 2007-08-28 19:38




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P2
Severity:
enhancement

 

Reporter:
chandler
Assigned To:
fry

Attachment Type Created Size Actions
Register/unregister methods section of PApplet.java text/plain 2007-08-03 21:08 4.98 KB

Description:   Opened: 2006-03-23 10:22
It would be handy in some instances if a library (or object see: http://
www.processinghacks.com/hacks/registerevents) could unregister from receiving draw, pre,
post, etc events.
Additional Comment #1 From ewjordan 2007-07-13 10:03
U
Additional Comment #2 From ewjordan 2007-07-13 10:08
Oops, sorry, last post I mistakenly hit submit before I was done.

What I was going to say was that unless someone has an objection, I'm going
to see what I can do about this one (at some point - can't work on it at
the moment, but I will soon). Basically I'm just planning to add an un-
version of each of the register functions, it should be a relatively easy add.

Let me know if anyone has already done this or thinks it shouldn't be done
for whatever reason.

Additional Comment #3 From fry 2007-07-13 10:10
go right ahead, thanks.. it should be a really simple fix. i was planning
to do it but haven't gotten around to it.
Additional Comment #4 From ewjordan 2007-08-03 21:08
edit]
Register/unregister methods section of PApplet.java

This is some code to add unregister* methods to PApplet. It should be possible
to just cut and paste it over the current method registration section - it
should replace everything from the ////... line at line 677 until the next set
of slashes right before setup(). The register* methods should all be the same,
but the class now has a remove() method and the unregister* ones have been
added.

If speed is an issue here, the array shift in the remove() method could be
replaced with a swap, but then we would lose any ordering guarantees. Not sure
if people are depending on order of execution here, so I left it as a shift to
be safe.
Additional Comment #5 From fry 2007-08-28 19:38
now added for 0126, thanks to ewjordan.