Removing widget listeners

Hi,

I’ve started using Widgets rather than assigning listeners to display objects. I did search a little but couldn’t find if we have to onPress, onDrag, onRelease listeners by ourselves(and how?) or is it removed by Corona SDK. How does it happen? [import]uid: 154911 topic_id: 34069 reply_id: 334069[/import]

From what I understand widget listeners are removed but I could be wrong [import]uid: 7911 topic_id: 34069 reply_id: 135460[/import]

Can you direct me to a document that implies or says that? [import]uid: 154911 topic_id: 34069 reply_id: 135461[/import]

I can’t put my hands on the documentation right now, but when you do a

someDisplayGroup:removeSelf()

it goes through and removes all the display objects attached to it, including other groups that are inside it. When a display object is removed it cleans up anything that belongs to that object, which includes it’s listeners. See:

http://developer.coronalabs.com/content/application-programming-guide-graphics-and-drawing#Removing_Objects_Properly

What doesn’t get removed are listeners attached to the Runtime, timers, transitions, audio tracks. You are responsible for removing them.

For widgets and their various events are all part of the widget’s “view” which for all intents and purposes is the same as a display.newGroup(). Doing a myWidget:removeSelf() will clean things up for you.
[import]uid: 199310 topic_id: 34069 reply_id: 135520[/import]

Thank you for the answer Rob. This one slipped my attention. [import]uid: 154911 topic_id: 34069 reply_id: 135553[/import]

From what I understand widget listeners are removed but I could be wrong [import]uid: 7911 topic_id: 34069 reply_id: 135460[/import]

Can you direct me to a document that implies or says that? [import]uid: 154911 topic_id: 34069 reply_id: 135461[/import]

I can’t put my hands on the documentation right now, but when you do a

someDisplayGroup:removeSelf()

it goes through and removes all the display objects attached to it, including other groups that are inside it. When a display object is removed it cleans up anything that belongs to that object, which includes it’s listeners. See:

http://developer.coronalabs.com/content/application-programming-guide-graphics-and-drawing#Removing_Objects_Properly

What doesn’t get removed are listeners attached to the Runtime, timers, transitions, audio tracks. You are responsible for removing them.

For widgets and their various events are all part of the widget’s “view” which for all intents and purposes is the same as a display.newGroup(). Doing a myWidget:removeSelf() will clean things up for you.
[import]uid: 199310 topic_id: 34069 reply_id: 135520[/import]

Thank you for the answer Rob. This one slipped my attention. [import]uid: 154911 topic_id: 34069 reply_id: 135553[/import]