if event.phase

Am trying to understand the java code of it all. In the Widget demo there is local function row listener ( event ) , then we use the ( print ) call which seems very basic,(ha, i’m a noob). I want to make a baking app and put receipes in each row, then after tapped, each recipe and picture is stored in a table. So I’ll have a reciepe and a image after the rowListener has been tapped and complete. I don’t know where the for i = 1, 100 do starts and ends.

  
-- Handles row presses/swipes  
 local function rowListener( event )  
 local row = event.row  
 local background = event.background  
  
 ------if event.phase == "press" then  
does my | print( "Pressed row: " .. row.index )  
code go here, | background:setFillColor( 0, 110, 233, 255 )  
or is there more |   
lines that are dependant off | row.textObj:setText( "Row pressed..." )  
the if.event.phase | row.textObj:setReferencePoint( display.TopLeftReferencePoint )  
 | row.textObj.x = 20  
 ------- end  
  
 elseif event.phase == "release" or event.phase == "tap" then  
 print( "Tapped and/or Released row: " .. row.index )  
 background:setFillColor( 0, 110, 233, 255 )  
 row.reRender = true  
  

[import]uid: 88495 topic_id: 34745 reply_id: 334745[/import]

No idea what you mean by “java code” since this is all Lua…anyway,

  1. It looks like you are asking about widget.newTableView()? That widget is structured into four pieces:
    i. The renderer (could be called at any time, describes what a row looks like)
    ii. The listener (describes what happens when you touch a row)
    iii. The row iterator (for i = 1, 100…, basically just adds rows to the internal table so the renderer has something to work with)
    iv. The declaration (something = widget.newTableView(), where the function is actually executed)

You’ve posted code of the touch listener, which only tells what to do when you touch a row, not how to create the rows.

(To answer your question specifically, I would store the recipe picture when you finish the press, which means within the elseif event.phase == "release" or event.phase == "tap" then section.) [import]uid: 41884 topic_id: 34745 reply_id: 138089[/import]

No idea what you mean by “java code” since this is all Lua…anyway,

  1. It looks like you are asking about widget.newTableView()? That widget is structured into four pieces:
    i. The renderer (could be called at any time, describes what a row looks like)
    ii. The listener (describes what happens when you touch a row)
    iii. The row iterator (for i = 1, 100…, basically just adds rows to the internal table so the renderer has something to work with)
    iv. The declaration (something = widget.newTableView(), where the function is actually executed)

You’ve posted code of the touch listener, which only tells what to do when you touch a row, not how to create the rows.

(To answer your question specifically, I would store the recipe picture when you finish the press, which means within the elseif event.phase == "release" or event.phase == "tap" then section.) [import]uid: 41884 topic_id: 34745 reply_id: 138089[/import]