how to "resend"/"rebroadcast" a captured event? (code attached)

This code if you run it has multiple rows of circles in a newScrollBar.  So:

  • If you click “outside” the circles you can drag the outer scrollbar up/down.  
  • If you click “inside” a circles you can drag that row left/right

What I want to do (and need advice on) is after I have detected the touch on a circle is actually moving in a vertical direction (already done in code below - but in the “moved” phase) that there is a way trigger the outer ScrollView to start working and scroll up/down.

You can see in the code (at **POINT 1**) where I’ve tried to return “false” to try to let the event through, however in the “moved” phase.  Perhaps there is a way to rebroadcast the event, but change the stage manually back to “begin” so the outer vertical scrollView picks it up?

Question: So in summary anyone able to get this code working so that after the “circleRowListener” decides it is an up/down movement (not horizontal) that it triggers the outer scrollView and the whole screen of circles then move up/down together?

display.setStatusBar( display.HiddenStatusBar )  local widget = require( "widget" ) local math\_abs = math.abs local displayW, displayH = display.contentWidth, display.contentHeight -- Background  background = display.newRect( displayW/2, displayH/2, displayW, displayH) background.strokeWidth = 0 background:setFillColor(.9, 0.9, .8) -- Outer ScrollView local scrollView = widget.newScrollView {     left = 20,    top = 20,     width = displayW - 40,    height = displayH - 40,     scrollWidth = displayW - 40, scrollHeight = 500,     backgroundColor = { 0.8, 0.8, 0.8 }, } -- Create Horizontal Inside Scroller with Circles Inside local function createHorizontalScroller()          -- Inner ScrollView listener     local function circleRowListener( event )         local t = event.target         local phase = event.phase                  if "began" == phase then             t.isFocus = true             t.onTouchStatus = nil                  -- Store initial position             t.x0 = event.x - t.x             t.y0 = event.y - t.y             t.initialX, t.initialY = event.x, event.y                      elseif t.isFocus then                          if "moved" == phase then                 local MOVEMENT\_THRESHOLD = 1                 if not t.onTouchStatus then                     -- Determine if Vertical or Horizontal                     local xDiff, yDiff = math\_abs(t.initialX - event.x),  math\_abs(t.initialY - event.y)                     if xDiff \> MOVEMENT\_THRESHOLD or yDiff \> MOVEMENT\_THRESHOLD then                         if xDiff \>= yDiff then                             -- Horizontal Move                             t.onTouchStatus = "Horizontal"                         else                             -- Vertical Move                             t.onTouchStatus = "Vertical"                         end                     end                     return true                                      else                     -- Carry out actions (already know whether it's vertical or horizontal)                     if t.onTouchStatus == "Horizontal" then                         -- Horizontal                         t.x = event.x - t.x0                     else                         -- Vertical                         print("gcSlider: Moved: return false")                         return false -- \*\* POINT 1 \*\*                     end                 end                              elseif "ended" == phase or "cancelled" == phase then                 display.getCurrentStage():setFocus( nil )                 t.isFocus = false                                  if t.onTouchStatus == "Horizontal" then                 else                     -- Vertical                     print("gcSlider: Ended: return false")                     return false                 end                              end         end              return true     end     local circleRowGroup = display.newGroup()          -- Add Circles     local RADIUS = 20     local xPos = RADIUS \* 2     for i=1,10 do         local myCircle = display.newCircle(0,0, RADIUS )         myCircle:setFillColor( .8,.9,.95 )         myCircle.strokeWidth = 1         myCircle:setStrokeColor( 0, 0, 1 )              circleRowGroup:insert(myCircle)         myCircle.x, myCircle.y = xPos, 25         xPos = xPos + RADIUS\*2 + 1     end          circleRowGroup:addEventListener("touch", circleRowListener)          return circleRowGroup end -- Create Multiple Rows of Circles local yPos = 50 for i=1,10 do     local tempInnerScrollView = createHorizontalScroller()     scrollView:insert(tempInnerScrollView)     tempInnerScrollView.y = yPos     yPos = yPos + 70 end

Have you tried storing the original event (on began) in a variable such as eventBegan, and then, on “moved”, using the following command or something like it?

scrollView:dispatchEvent(eventBegan)

thanks just tried this plus: “Runtime:dispatchEvent(circleRowGroup.beganEvent)” and it doesn’t seem to work, so I guess it isn’t really triggering the newScrollView’s begin for some reason.

Rob - any ideas?  

Isn’t this a use for http://docs.coronalabs.com/api/type/ScrollViewWidget/takeFocus.html

Rob - you’re amazing! - thanks this works  :)

Have you tried storing the original event (on began) in a variable such as eventBegan, and then, on “moved”, using the following command or something like it?

scrollView:dispatchEvent(eventBegan)

thanks just tried this plus: “Runtime:dispatchEvent(circleRowGroup.beganEvent)” and it doesn’t seem to work, so I guess it isn’t really triggering the newScrollView’s begin for some reason.

Rob - any ideas?  

Isn’t this a use for http://docs.coronalabs.com/api/type/ScrollViewWidget/takeFocus.html

Rob - you’re amazing! - thanks this works  :)