Widget 2.0 - Tableview - Android Build - Release/press Event Issues

+1 it’s very difficult to press row…

need “tap” emergency

I am using tap in all my apps…

thanks

I found another important issue

I cant drag my tableview on “Category” row

that’s if i set “isCategory = true” 

that row i can’t drag…that’s looks like my table view is broken.

sometimes can drag  sometimes not…

and first row sometimes get nil parameter on “isCategory”

pleas fix it ASAP!! thanks!!

A tap event has been added and will be in your hands shortly. Thanks

See my comment above :slight_smile:

another critical bug about row.!

Can’t delete row correctly!

I alter it from Sample ListView1

change default size from 20 to 5

  local function onRowTouch( event )     local phase = event.phase --    local row = event.target     local row = event.row     if "press" == phase then         print( "Pressed row: " .. row.index )       elseif "release" == phase then         -- Update the item selected text         itemSelected.text = "You selected item " .. row.index                  --Transition out the list, transition in the item selected text and the back button --        transition.to( list, { x = - list.contentWidth, time = 400, transition = easing.outExpo } ) --        transition.to( itemSelected, { x = display.contentCenterX, time = 400, transition = easing.outExpo } ) --        transition.to( backButton, { alpha = 1, time = 400, transition = easing.outQuad } )                          print("event.row.index",event.row.index)                 print("event.target.index",event.target.index)         print( "Tapped and/or Released row: " .. row.index )                 list:deleteRow(event.target.index)     end end

PS: event.target is the row, event.row is nil as it doesn’t exist.

it exists.

i run it on 1076.

i also tried “event.target.index” . got same situation

event.target.index will not work anymore with widget 2.0 … 

It is likely that i just don’t get what your trying to communicate but … before Widget 2.0 you would use:

event.target to get the row

and

event.target.index to get the index

Now with Widget 2.0 you MUST change that to use:

event.row to get the row

and

event.row.index to get the index

Danny,

Working with 1080 and not seeing this TAP support.  I do not see anything in the documentation that suggests how to access this support for tap.  I tried adding an onRowTap listener but that does not seem to be the ticket.

Can you let us know how to access the Tap handling on the tableview rows?

Thanks,

m

The changes didnt make it into 1080. When they do you will se the widget related notes in the release notes for that daily build.

The support is added (as is the other stuff i mentioned like row performance) i will find out what daily build the changes will be added in.

Thanks

So i tried build 1080 … i see now that when i tap a row the onRowTouch event is triggered and the event.phase is == “tap”

The problem i now have is that when the event.phase == “tap”

local row = event.row

row is nil

If event phase is “touch” all is fine … just when event.phase == “tap” does the event.row return nil.

Please fix this at your earliest convenience … this is actually worse than not having tap.

In the latest build 1093, i’m using event.target.

The worst problem for me, is that “tap” is triggered even if table is currently scrolling.

I try to get property “_view._velocity” but is always 0, i think it’s because the property “_view._trackVelocity” is “false”, and even if i try to change it to true, the next time event was dispatched, it’s set to “false” again.

In the scrollView that didn’t happen, the velocity and trackVelocity are working correctly. So if “_velocity” is not 0 ignore the “tap” event.

I can confirm this inconsistency.

If phase = “tap” there is no event.row, just an event.target. For other phases there is an event.row which according to the docs is what we should use to reference the row.

What I’ve done temporarily at the top of my onRowTouch function is to add this:

if (event.row == nil) then event.row = event.target; end  

As it was said before it’s very difficult to press a row.

I can add a “tap” listener when creating the row, but if row was taped when scroll is happening the scroll stop (as it should ) but the tap event is dispatched (and it shouldn’t), the event should only be dispatched when the table isn’t scrolling.

I arrived here because ‘event.row’ was returning ‘nil’ for the event ‘release’ for me, and I was also hoping to find some clarity on “press” vs “tap” vs “release”. From what I’ve read on this thread, “tap” looks like the most sensible event to listen for when all you’re interested in is what row the user wants to select.

So I’m guessing ‘press’ and ‘release’ are more raw events, with which one could do fancier tableview footwork? Anyone have a clearer explanation of ‘press’ vs ‘release’ vs ‘tap’? What are circumstances where one would want to listen to ‘press’ and ‘release’ but not ‘tap’?

@fernandomgf

I’ve fixed the “tap” while scrolling issue in my fork of the OpenSource Widget 2.0.

@bobbycircle

Well, off the top of my head, I’d say that “tap” would be used when normally selecting a row.

Let’s say you’d like functionality to move rows up/down in a list. You’d listen for “press” to select the row for moving and “release” when you’ve moved it to where you want it.

So i tried build 1080 … i see now that when i tap a row the onRowTouch event is triggered and the event.phase is == “tap”

The problem i now have is that when the event.phase == “tap”

local row = event.row

row is nil

If event phase is “touch” all is fine … just when event.phase == “tap” does the event.row return nil.

Please fix this at your earliest convenience … this is actually worse than not having tap.

In the latest build 1093, i’m using event.target.

The worst problem for me, is that “tap” is triggered even if table is currently scrolling.

I try to get property “_view._velocity” but is always 0, i think it’s because the property “_view._trackVelocity” is “false”, and even if i try to change it to true, the next time event was dispatched, it’s set to “false” again.

In the scrollView that didn’t happen, the velocity and trackVelocity are working correctly. So if “_velocity” is not 0 ignore the “tap” event.

I can confirm this inconsistency.

If phase = “tap” there is no event.row, just an event.target. For other phases there is an event.row which according to the docs is what we should use to reference the row.

What I’ve done temporarily at the top of my onRowTouch function is to add this:

if (event.row == nil) then event.row = event.target; end  

I found out that the “release” phase does not fire if you press a row, drag then release. A feature like custom row background change on press and back to the original on release is not possible, the background will remain in the pressed state if the row is dragged. It used to work in version 1.

The following code is supposed to change the alpha of the row to 0.5 on press and back to 1 on release which works fine if you press then release but not if you press then drag the row then release:

[lua]

local function onRowTouch(event)

    local row = event.target

    if event.phase == “press” then

        row.alpha = 0.5

    elseif event.phase == “release” then

        row.alpha = 1

    end

end

[/lua]

That is intentional. Look at how it works on iOS natively. If you press then drag a row, after focus is removed from it (ie it’s highlight), the release event shouldn’t fire because the row is no longer active.

As a compromise I guess a “cancelled” event could be fired for the row in question.