I have recently discovered the sample code that comes with Corona and I am trying to learn from it. One piece of code that I didn't understand was from a smaple project under Graphics\FilterViewer. The code is as follows:
local function onRowTouch( event ) if ( event.target.canTest == false ) then return end if ( event.phase == "press" ) then list.actionOnRelease = true elseif ( event.phase == "cancelled" ) then list.actionOnRelease = false end if ( "release" == event.phase and list.actionOnRelease == true ) then list.actionOnRelease = false ... .... Some other code goes here ... ... end end
local function scrollListener( event ) if ( event.x and event.xStart and ( math.abs( event.x - event.xStart ) > 10 ) ) then list.actionOnRelease = false end return true end
Can someone please explain to me:
1- What are we trying to achieve by setting the list.actionOnRelease to false/true.
2- What is a "cancelled" phase?
3- The "onRowTouch" function doesn't return "true" while the "scrollListener" does. Why/When do we need to return true?
I looked at
but it doesn't mention the "cancelled" phase.