Hi Rob,
Yes no problem this is my latest code.
[lua]
–
– incidentReportingPg1.lua
–
local composer = require( “composer” )
local scene = composer.newScene()
local widget = require( “widget” )
local myData = require( “myData” )
function onComplete( event )
if event.action == “clicked” then
local i = event.index
if i == 1 then
end
end
end
function scene:create( event )
local sceneGroup = self.view
–bg
local bg = display.newRect( 0, 0, display.contentWidth, display.contentHeight )
bg.anchorX = 0
bg.anchorY = 0
bg:setFillColor( 0.9, 0.9, 0.9 ) – white
sceneGroup:insert ( bg )
–titleHeader
local titleHeader = display.newImage( “titleHeader.png” )
titleHeader:translate( 160, -22 )
–title
local title = display.newText( “Incident Reporting”, 0, 0, native.systemFont, 32 )
title:setFillColor( 0 ) – black
title.x = display.contentWidth * 0.5
title.y = -25
–textPage
local textPage = display.newText(“Page 22”,
280,130, display.contentWidth -25 , display.contentHeight * 0.5, native.systemFont, 15 )
textPage:setFillColor( 0, 0, 0 )
– Handle press events for the buttons
local function onSwitchPress( event )
local switch = event.target
print( “Switch with ID '”…switch.id…"’ is on: "…tostring(switch.isOn) )
end
– Image sheet options and declaration
local options = {
width = 26,
height = 26,
numFrames = 2,
sheetContentWidth = 26,
sheetContentHeight = 52
}
local checkboxSheet = graphics.newImageSheet( “checkboxSheet.png”, options )
– Create a group for the radio button set
local radioGroup = display.newGroup()
– Create two associated radio buttons (inserted into the same display group)
local radioButton1 = widget.newSwitch
{
left = 20,
top = 100,
style = “radio”,
id = “RadioButton1”,
width = 26,
height = 26,
onPress = onSwitchPress,
sheet = checkboxSheet,
frameOff = 1,
frameOn = 2
}
radioGroup:insert( radioButton1 )
sceneGroup:insert( radioButton1 )
local radioButton2 = widget.newSwitch
{
left = 20,
top = 140,
style = “radio”,
id = “RadioButton2”,
width = 26,
height = 26,
onPress = onSwitchPress,
sheet = checkboxSheet,
frameOff = 1,
frameOn = 2
}
radioGroup:insert( radioButton2 )
sceneGroup:insert( radioButton2 )
local radioButton3 = widget.newSwitch
{
left = 20,
top = 180,
style = “radio”,
id = “RadioButton3”,
width = 26,
height = 26,
onPress = onSwitchPress,
sheet = checkboxSheet,
frameOff = 1,
frameOn = 2
}
radioGroup:insert( radioButton3 )
sceneGroup:insert( radioButton3 )
–textCheck1
local textCheck1 = display.newText(“textCheck1”,
210, 225, display.contentWidth, display.contentHeight * 0.5, native.systemFont, 13 )
textCheck1:setFillColor( 0, 0, 0 )
sceneGroup:insert( textCheck1 )
–textCheck2
local textCheck2 = display.newText(“textCheck2”,
210, 265, display.contentWidth, display.contentHeight * 0.5, native.systemFont, 13 )
textCheck2:setFillColor( 0, 0, 0 )
sceneGroup:insert( textCheck2 )
–textCheck3
local textCheck3 = display.newText(“textCheck3”,
210, 305, display.contentWidth, display.contentHeight * 0.5, native.systemFont, 13 )
textCheck3:setFillColor( 0, 0, 0 )
sceneGroup:insert( textCheck3 )
function OnBtnNext( event )
if radioButton1.isOn == true or radioButton2.isOn == true or radioButton3.isOn == true then
composer.gotoScene( “riskAssessmentPg1”, { effect=“slideLeft”, time=800,} )
elseif radioButton1.isOn == false and radioButton2.isOn == false and radioButton3.isOn == false then
local alert = native.showAlert( “Warning”, “ERROR: No input in checkbox(s)”, { “OK” }, onComplete)
elseif radioButton1.isOn == true then
myData.IRb1 = textCheck1
end
end
–btnNext
local btnNext = widget.newButton
{
width = 150,
height = 40,
defaultFile = “btnNext.png”,
onEvent = OnBtnNext
}
btnNext.x = 235
btnNext.y = 445
local function home( event )
composer.gotoScene( “forms”, { effect=“slideRight”, time=800} )
end
local btnHome = widget.newButton
{
width = 320,
height = 50,
defaultFile = “home.png”,
onEvent = home,
}
btnHome.x = 160
btnHome.y = 499
–sceneGroup
sceneGroup:insert( titleHeader )
sceneGroup:insert( title )
sceneGroup:insert( textPage )
sceneGroup:insert( btnNext )
end
function scene:show( event )
local sceneGroup = self.view
end
function scene:hide( event )
local sceneGroup = self.view
end
function scene:destroy( event )
local sceneGroup = self.view
end
– Listener setup
scene:addEventListener( “create”, scene )
scene:addEventListener( “show”, scene )
scene:addEventListener( “hide”, scene )
scene:addEventListener( “destroy”, scene )
return scene
[/lua]
Thanks again,
Matt.