Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Giving tableview widget two touch listeners
Started by sharongirl21 Oct 10 2017 02:27 PM

No replies to this topic
widget tablieview listener two listeners
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

sharongirl21

[GLOBAL: userInfoPane.html]
sharongirl21
  • Enthusiast

  • 43 posts
  • Corona SDK

In my previous question, I mentioned I was making my own slide-menu panel and got some help with making a touch listener that made the panel follow the user's finger. My new problem is that my menu use the tableview widget to list menu items. I want the panel to slide when the user slides his finger on the table but also to perform the assigned function when the table item is clicked, like sliding menu's in most android applications. I'm basically trying to make it use both the onRowTouch listener and my slideTouch listener but nothing I've tried has worked, any ideas?

 

Here's my slideTouch listener:

dialog_object.limit =  diaObjX

    local function slideTouch (event)
        
        if (event.phase == "began") then
            dialog_object.startX = dialog_object.x
            dialog_object.lastTime = event.time
        elseif (event.phase == "moved") then

            dialog_object.deltaTime = event.time - dialog_object.lastTime
            dist = ( (event.x - (backdrop.width/2)) - (event.xStart - (backdrop.width/2)) )
            
		    dialog_object.speed = dist / dialog_object.deltaTime
            print ( dialog_object.speed )

            if (dialog_object.startX + dist) <= dialog_object.limit then
                dialog_object.x = dialog_object.startX + dist
            end
        elseif (event.phase == "cancelled") or (event.phase == "ended") then

            if (dialog_object.x <= obj_edge) or (( dialog_object.speed * (-1) ) >= 0.8) then
                    group:close()
            else
                transition.to(dialog_object, { x= dialog_object.limit, time = 100, transition=easing.linear})
            end
        end

        return true
    end 

And here's my onRowTouch listener:

local function onRowTouch( event )
        local row = event.target
        local params=event.target.params

        if event.phase == "release" or event.phase == "ended" then
            group:close()

            if params.onClick then
                params.onClick()
            end   
        end
        return true
    end

I have the tableview widget on a white rectObject and they're both in a group called dialog_object.

The slidetouch listener is currently attached to the white rectObject so anywhere that doesn't have the table widget on it slides as wanted but sliding on the tableview widget does nothing

I'd appreciate the help, thank you!




[topic_controls]
[/topic_controls]