local function onSwitchPressTheme( event ) local switch = event.target print( "Switch with ID '"..switch.id.."' is on: "..tostring(switch.isOn) ) myData.settings.theme = switch.id utility.saveTable(myData.settings, "settings.json") end local function onSwitchPress( event ) local switch = event.target print( "Switch with ID '"..switch.id.."' is on: "..tostring(switch.isOn) ) myData.settings.language = switch.id utility.saveTable(myData.settings, "settings.json") end -- Create a group for the radio button set local radioTheme = display.newGroup() local sampleTheme1 = display.newImage("tmbsample.png", 65, soundLabel.y + 35) sampleTheme1.width=35 sampleTheme1.height=35 sceneGroup:insert( sampleTheme1 ) local sampleTheme2 = display.newImage("tmbt2sample.png", 65, soundLabel.y + 75) sampleTheme2.width=35 sampleTheme2.height=35 sceneGroup:insert( sampleTheme2 ) -- Create two associated radio buttons (inserted into the same display group) local radioButtonTheme1 = widget.newSwitch { left = 15, top = soundLabel.y + 20, style = "radio", id = 1, onPress = onSwitchPressTheme, initialSwitchState = themeSaatIni[1], } radioTheme:insert( radioButtonTheme1 ) local radioButtonTheme2 = widget.newSwitch { left = 15, top = soundLabel.y + 60, style = "radio", id = 2, onPress = onSwitchPressTheme, initialSwitchState = themeSaatIni[2], } radioTheme:insert( radioButtonTheme2 ) sceneGroup:insert( radioButtonTheme1 ) sceneGroup:insert( radioButtonTheme2 ) -- 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 = 100, top = languageLabel.y + 20, style = "radio", id = "en", onPress = onSwitchPress, initialSwitchState = languageSaatIni[1], } radioGroup:insert( radioButton1 ) local radioButton2 = widget.newSwitch { left = 100, top = languageLabel.y + 60, style = "radio", id = "id", onPress = onSwitchPress, initialSwitchState = languageSaatIni[2], } radioGroup:insert( radioButton2 ) sceneGroup:insert( radioButton1 ) sceneGroup:insert( radioButton2 )
It’s clear that I have each group buttons separated from each other. Am I wrong?