daily build 1260 broke scrollview listeners

The following code will print “began scrolling” in the console if the user drags the scrollview in daily 1257, but in daily 1260 the listener never gets called.

    local widget = require( "widget" )  -- for the scrollview     local function scrollListener( event )         local phase = event.phase         if "began" == phase then             print("began scrolling")         end         return true     end         -- Create a ScrollView     local scrollView = widget.newScrollView         {         top = 75,         left = 20,         width = 280,         height = 300,         topPadding = 75,          bottomPadding = 50,          listener = scrollListener,         hideScrollBar = true,         horizontalScrollDisabled = true,         hideBackground = true,         }  

Correction, the listener is getting called.  If I add 

print("made it to listener")  

to the first line of the listener function I do see that printed in the console.  But the “began” phase check is never encountered with daily build 1260 but it is in 1257.

its not only a problem with “began”. I put a print (phase) call in my listener and I’m getting nil printed in place of began, moved and ended phases. So it seems like none of these guys are making it through… Back to Alex!

edit - on a positive note, direction works though! :slight_smile:

I’m in the process of “upgrading” my in-progress app to G2.0/2076 and this is still an issue.  I filed a bug report, Case 28111.

Thanks for flagging this. There are at least two other threads in different areas of the forum (widgets and advanced graphics) noting that event.phase is returning nil:

http://forums.coronalabs.com/topic/41489-scrollview-eventphase-returns-nil/

http://forums.coronalabs.com/topic/41531-eventphase-not-detected-in-scrolllistener-of-scrollview/

I filed it as a bug yesterday afternoon (Case 28117) but have not received a response from Corona yet.

FYI, Brett from Corona replied in another thread and said it would be fixed “soon” in a daily build:

http://forums.coronalabs.com/topic/41489-scrollview-eventphase-returns-nil/

I thought I broke something with my code by my today’s change

although it only took me 10 mins to find out it’s because of the latest build that breaks scrollView

Corona should pay the medicine fee for my heart attack 

So daily build 2013.2082 came out today, and there’s no mention of the scrollview bug being fixed:

http://developer.coronalabs.com/release/2013/2082/

:frowning:

Hi guys,

Let’s try to keep this in one thread… there are like 3 threads out there reporting this, so we’re well aware of it. :slight_smile:

This should be fixed in the next build, after #2082.

Brent

Yay! 

Daily build 2013.2085: “Widget 2.0: Fixes the scrollView event.phase not being passed to the listener” http://developer.coronalabs.com/release/2013/2085/

Thanks, Brent!

2085 fixed my scrollView event issues.  Thanks, Brent!

Something is still a little wonky. If you uncomment those event phase print statements so you get to see began, moved and ended and then try the following on WidgetDemo tab 1…

  1. Click and hold on a row.
  2. Move up and down without releasing … you will see moved printed in console which is normal. 
  3. Then while still holding on the same row move your cursor left to right… you will still see moved printed in console but actually tabView is not moving. Its actually a slideleft event followed by slideright event etc… 
  4. Then release the click and you will see one more moved event and then a nil printed to console…
  5. If you follow the above you also don’t get the next window fire up that says you pressed on Row x etc with the back button. 

Not sure whats wrong there but something slightly off. Good to see widgets getting good attention. Thank you very much!

Hi Kerem,

Have you proven that you didn’t slide the row/view slightly up (or down) while holding it and sliding right (or left)? Even one or two pixels? Can you confirm that this didn’t happen previously in earlier builds?

Can anybody else replicate what Kerem reports here? 

Brent

Hi Brent, 

I had not noticed this before so I went back and downloaded #1235 just to check. The same behavior is there too. I think slide left / right is still firing so the fact that moved is also firing there is perhaps not so much of an issue. The bigger issue is that if you press & hold on a row and move up and down and then release the normal OnTap Release is not happening. Not a huge issue but one that can use some attention at some point. Thanks for your help. 

Regards,

Kerem

For anyone who doesn’t have a subscription to get the daily build with the fix, I hacked out a quick fix in the meantime:

local isBegan = true local scrollTimer      -- ScrollView listener local function scrollListener( event )             if(scrollTimer~=nil)then         timer.cancel(scrollTimer)     end              if(isBegan==true)then         print("Phase Began")         isBegan = false else print("Phase Moved")     end              local function phaseEnded()         print("Phase Ended")         isBegan = true     end scrollTimer=timer.performWithDelay(150,phaseEnded,1) end  

If it’s a slow swipe, the began phase might be called multiple times…if this is happening, increase the timer from 150 to 200 or 300. Tweak around a bit, and you should get it good enough for the moment!

Correction, the listener is getting called.  If I add 

print("made it to listener")  

to the first line of the listener function I do see that printed in the console.  But the “began” phase check is never encountered with daily build 1260 but it is in 1257.

its not only a problem with “began”. I put a print (phase) call in my listener and I’m getting nil printed in place of began, moved and ended phases. So it seems like none of these guys are making it through… Back to Alex!

edit - on a positive note, direction works though! :slight_smile:

I’m in the process of “upgrading” my in-progress app to G2.0/2076 and this is still an issue.  I filed a bug report, Case 28111.

Thanks for flagging this. There are at least two other threads in different areas of the forum (widgets and advanced graphics) noting that event.phase is returning nil:

http://forums.coronalabs.com/topic/41489-scrollview-eventphase-returns-nil/

http://forums.coronalabs.com/topic/41531-eventphase-not-detected-in-scrolllistener-of-scrollview/

I filed it as a bug yesterday afternoon (Case 28117) but have not received a response from Corona yet.

FYI, Brett from Corona replied in another thread and said it would be fixed “soon” in a daily build:

http://forums.coronalabs.com/topic/41489-scrollview-eventphase-returns-nil/