Hi everyone,
probably it’s a stupid question, but this it’s making me crazy… I’m building an app to donate to my city and i started doing that from the business application sample posted in the forum. I have the bottom bar and also graphical buttons in the menu.lua file. Now, the big problem: i can’t do a row with the list of offices. Reading on the forum and from corona resources I made a newTableView widget, but the row is completely empty, I’m not able to understand how insert text and images and, most of all, how to link to an “article” with office name, phone number, photo of the officer, map position and so on… Beyond that, with my actual code, the row stay visible also going to other scenes with the tabbar.
Please could you explain me how to do this? Thanks so much
local storyboard = require( "storyboard" ) local scene = storyboard.newScene() local widget = require( "widget" ) local myApp = require( "myapp" ) widget.setTheme(myApp.theme) local titleText local locationtxt local views = {} local function ignoreTouch( event ) return true end function scene:createScene(event) local group = self.view local background = display.newRect(0,0,display.contentWidth, display.contentHeight) background:setFillColor(242, 242, 242, 255) group:insert(background) background:addEventListener("touch", ignoreTouch) local statusBarBackground = display.newImageRect(myApp.topBarBg, display.contentWidth, display.topStatusBarContentHeight) statusBarBackground.x = display.contentCenterX statusBarBackground.y = display.topStatusBarContentHeight \* 0.5 group:insert(statusBarBackground) -- -- Create the other UI elements -- create toolbar to go at the top of the screen local titleBar = display.newImageRect(myApp.topBarBg, display.contentWidth, 50) titleBar.x = display.contentCenterX titleBar.y = 25 + display.topStatusBarContentHeight group:insert(titleBar) -- -- set up the text for the title bar, will be changed based on what page -- the viewer is on local function listener( event ) local shouldLoad = true local url = event.url if 1 == string.find( url, "corona:close" ) then -- Close the web popup shouldLoad = false end if event.errorCode then -- Error loading page print( "Error: " .. tostring( event.errorMessage ) ) shouldLoad = false end return shouldLoad end local options = { hasBackground=false, baseUrl=system.DocumentsDirectory, urlRequest=listener } titleText = display.newText( "Info", 0, 0, GillSans, 20 ) titleText:setTextColor( 255, 255, 255 ) titleText:setReferencePoint( display.CenterReferencePoint ) titleText.x = display.contentCenterX titleText.y = titleBar.height \* 0.5 + display.topStatusBarContentHeight group:insert(titleText) end local widget = require( "widget" ) -- Create a tableView local newTableView = widget.newTableView{ width = 320, height = 448, topPadding = 70, bottomPadding = 8, hideBackground = true, maskFile = "mask-320x448.png" } local rowText = {"Non", "ci","riesco"} local function onRowRender( event ) local phase = event.phase local row = event.row local rowTitle = display.newText( row, "some text", 0, 0, native.systemFont, 14 ) rowTitle.x = row.x - ( row.contentWidth \* 0.5 ) + ( rowTitle.contentWidth \* 0.5 ) rowTitle.y = row.contentHeight \* 0.33 rowTitle:setTextColor( 0, 0, 0 ) local someImage = display.newImageRect(row, "coffee1.png", 64, 25) someImage.x = row.contentWidth - 68 someImage.y = 15 end local function onRowTouch( event ) local row = event.row local background = event.background if event.phase == "press" then print( "Pressed row: " .. row.index ) background:setFillColor( 0, 110, 233, 255 ) elseif event.phase == "release" or event.phase == "tap" then director:changeScene("misc"..row.index) print( "Tapped and/or Released row: " .. row.index ) background:setFillColor( 0, 110, 233, 255 ) row.reRender = true end end -- insert rows into list (tableView widget) for i = 1, 3 do newTableView:insertRow{ height = 85, rowColor = { 255, 255, 255, 60 }, onRender = onRowRender, listener = onRowTouch } end function scene:destoryScene( event ) local group = self.view end --------------------------------------------------------------------------------- -- END OF YOUR IMPLEMENTATION --------------------------------------------------------------------------------- scene:addEventListener( "createScene", scene ) scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene ) scene:addEventListener( "destroyScene", scene ) --------------------------------------------------------------------------------- return scene